最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery ui tooltip for checkbox - Stack Overflow

programmeradmin4浏览0评论

I can't get the jquery ui tooltip to show for a checkbox...am I doing something wrong or is this not possible?

<input name="item.AutoOpen" class="check-box" id="item_AutoOpen" type="checkbox" CHECKED="checked" data-val-required="The Auto Open field is required." data-val="true" value="true"/>

 <button class='m-btn blue' title="test" style='width: 200px;margin:4px;'>hello</button>
​
<script type="text/javascript">
    $(function () {
        $("*").tooltip({ content: "Awesome title!" });     
    });
</script>

Works for the button but not the checkbox.

/

EDIT: wasn't working because of the lack of a title (which I had avoided adding because you cant add a title easily using EditorFor in ASP.Net MVC)...

Solution:

 $(':checked').attr('title', 'Auto Load').tooltip();       

I can't get the jquery ui tooltip to show for a checkbox...am I doing something wrong or is this not possible?

<input name="item.AutoOpen" class="check-box" id="item_AutoOpen" type="checkbox" CHECKED="checked" data-val-required="The Auto Open field is required." data-val="true" value="true"/>

 <button class='m-btn blue' title="test" style='width: 200px;margin:4px;'>hello</button>
​
<script type="text/javascript">
    $(function () {
        $("*").tooltip({ content: "Awesome title!" });     
    });
</script>

Works for the button but not the checkbox.

http://jsfiddle/XseWc/123/

EDIT: wasn't working because of the lack of a title (which I had avoided adding because you cant add a title easily using EditorFor in ASP.Net MVC)...

Solution:

 $(':checked').attr('title', 'Auto Load').tooltip();       
Share Improve this question edited Dec 4, 2012 at 11:25 woggles asked Dec 4, 2012 at 11:05 woggleswoggles 7,46413 gold badges77 silver badges132 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

Add title attribute to the checkbox

发布评论

评论列表(0)

  1. 暂无评论