0
<div class="span3">
                <label>Restaurants <span class="f_req">*</span></label> <select
                    id="rest_id" name="rest_id"
                    data-placeholder="- Select Restaurants -" class="chzn-select"multiple ">
                    <%
                        List <restaurant> rest_list=restaurantLocalServiceUtil.getAllRestaurantByOrganizationId(themeDisplay);                                                          
                                                        for(int i=0;i<rest_list.size();i++) {
                    %>
                    <option id="<%=rest_list.get(i).getPrimaryKey()%>"
                        value=<%=rest_list.get(i).getPrimaryKey()%>><%=rest_list.get(i).getName().toString()%>
                    </option>
                    <%
                        }
                    %>
                </select> <span id="restError3" style="color: #C62626;" class="help-block"></span>
            </div>

以上是我在 jsp 代码中的一个部门的片段。它在多选框中列出了餐馆。我想要做的是,我想显示有关餐厅的一些其他详细信息作为工具提示,鼠标悬停在列表框中或选定餐厅中的餐厅名称上...工具提示详细信息,例如(餐厅城市,或地址,或州)..所以我怎么能证明这一点?谁能告诉我怎么做?

4

1 回答 1

2

The tooltip is represented by the HTML element's title attribute.

For example,

<option value="42" title="This is option with label 'Foo' and ID 42">Foo</option>

I'm not sure why you tagged this jQuery, but if you want fanciness, then just pick one of the many available jQuery tooltip plugins. Do however note that almost all of them do that based on the value of the HTML element's title attribute. The only what they effectively do is to turn the "standard" tooltip look'n'feel into some flashy look'n'feel by removing the title attribute and baking a bunch of <div> and CSS, etc boilerblate which shows up on mouse over.

于 2013-01-12T15:33:43.053 回答