2

i'm using jQuery UI 1.9 to make buttons of checkboxes and for tooltips. My HTML is simple:

<input type="checkbox" id="jq-ui-button" value="Test" title="tooltipppp">
<label for="jq-ui-button">Label ok</label>

Then i call in JS:

$("input[type='checkbox']").button();
$("input[type='checkbox']").tooltip();

http://jsfiddle.net/rniestroj/JnApC/

The problem is that i see the tooltip when i click the button/checkbox but i want to see the tooltip normally on hover. Is this a bug in jQuery UI 1.9 or how can i achieve the effect i want?

1 Answer 1

3

My understanding is that when .button() is applied to a checkbox, it is the associated label that is styled to be the button. It may therefore be necessary to apply the .tooltip() to the label rather than to the checkbox itself:

$("input[type='checkbox']").button();
$("label[for='jq-ui-button']").tooltip();

The associated title attribute would therefore also need to be applied to the label instead:

<input type="checkbox" id="jq-ui-button" value="Test">
<label for="jq-ui-button" title="tooltipppp">Label ok</label>
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, this will work. The title attribute should also be relocated to the <label> element. Updated fiddle here. Also note you can apply tooltips globally by calling $(document).tooltip() once instead of $("selector").tooltip() for several selectors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.