JQuery UI ButtonSet工具提示

Cof*_*fka 2 html jquery jquery-ui

是否有任何标准方法为buttonset中的每个radiobutton添加工具提示?

<span id="tools">
    <input type="radio" id="feature1" name="tool" title="feature 1"><label for="feature1">Tool 1</label>
    <input type="radio" id="feature2" name="tool" title="feature 2"><label for="feature2">Tool 2</label>
</span>
Run Code Online (Sandbox Code Playgroud)

和脚本:

$('#tools').buttonset();
Run Code Online (Sandbox Code Playgroud)

我已经为每个输入添加了标题,但没有任何工具提示.

小智 5

你可以使用这样的东西

$(function() {
    ?$('label').each(function() {
        var radio = $(this).prop('for')????????;
        $(this).prop('title',$('#' + radio).prop('title'));
    });
});
Run Code Online (Sandbox Code Playgroud)

它所依赖的只是jQuery,每个标签的for属性都是正确的.