How can i add a Tooltip in chosen jquery plugin? [closed]

[亡魂溺海] 提交于 2019-12-13 09:17:34

问题


Hi iam working on chosen jquery plugin and i need to add tooltip to all the elements in chosen plugin. I tried tweaking around in chosen but didn't get any positive result. Does anyone have any idea?

Code:

  <div id="synonyms_div" style="height:auto;width:170px;">
     <select id="tagger-tags" class="tagger-tags" multiple style="width:150px; font:7px;" tabindex="4">
                @foreach(var tag in ViewBag.tags)
                {
                    <option id="sel-tags" value="@tag.ID" parent="@tag.PARENT_ID" style="font:6px;">
                        @tag.NAME [@tag.EL_COUNT]
                    </option>
                }               
      </select>
    </div>
<script>
$(document).ready(function () {
    jQuery(".tagger-tags").chosen({ search_contains: true });

});
 </script>

回答1:


Here's a possible solution without having to use any other libraries, or anything else... This can be accomplished with a bit of CSS.

HTML:

<!--// we have to wrap the select in a span to use :after with it //-->
<span class="tooltip" title="some title for your tooltip">
<select>
    <option>Something</option>
    <option>Something Else</option>
</select>
</span>

CSS:

.tooltip:hover:after {
    position: relative;
    /* we can get the title attribute from the relevant item */
    content: "" attr(title) "";
    /* style however you want */
    border: 1px dashed black;
    top: -1.5em;
    left: 12em;
    padding: 0.5em;
}

Will give you something like:

DEMO

Literally added the word multiple to the select box in order to modify it to fit OP's requirements...

DEMO 2




回答2:


I'm not sure if I understand the question, but I'm almost positive you want to be using this: http://jqueryui.com/tooltip/



来源:https://stackoverflow.com/questions/17818153/how-can-i-add-a-tooltip-in-chosen-jquery-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!