如何在所选的jquery插件中添加工具提示? [英] How can i add a Tooltip in chosen jquery plugin?

查看:96
本文介绍了如何在所选的jquery插件中添加工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,iam在选择的jquery插件上工作,我需要向选择的插件中的所有元素添加工具提示.我尝试调整所选内容,但没有得到任何积极的结果.有人有什么主意吗?

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?

代码:

  <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>

推荐答案

这是一种可能的解决方案,而无需使用任何其他库或其他任何方法……这可以通过使用一些CSS来实现.

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;
}

会给你类似的东西

演示

DEMO

从字面上将单词multiple添加到选择框中,以便对其进行修改以符合OP的要求...

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

演示2

DEMO 2

这篇关于如何在所选的jquery插件中添加工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆