Coffka
Coffka

Reputation: 759

JQuery UI ButtonSet Tooltips

Is there any standard approach to add tooltip for each radiobutton in buttonset?

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

and script:

$('#tools').buttonset();

I've already added title for each input but there are no any tooltips.

Upvotes: 2

Views: 765

Answers (2)

Juan Ibiapina
Juan Ibiapina

Reputation: 300

You could simply move the title attribute to the label.

Upvotes: 0

user1865331
user1865331

Reputation:

You could use something like this

$(function() {
    ​$('label').each(function() {
        var radio = $(this).prop('for')​​​​​​​​;
        $(this).prop('title',$('#' + radio).prop('title'));
    });
});

​ All that it relies on is jQuery and the for attribute for each label is correct.

Upvotes: 5

Related Questions