开发者

jQuery .button() not working

I'm trying to use jQuery .button() on a checkbox, but i can't understand why this is'not working.

this is the javascript code:

$('#login_checkbox').button();

and this is the html code:

<input id="login_checkbox" type="checkbox" value="login_remember"/><label>Remember me</la开发者_Go百科bel>

I'm doing everything exacly as shown here: http://jqueryui.com/demos/button/#checkbox


Add in the for attribute or it won't know which label to use:

<label for="login_checkbox">Remember me</label>


Is that code running in a "ready" handler, or just naked in a <script> block in the head of your page?

In other words, are you sure that the element exists at the time the Javascript code runs? That's a really easy mistake to make, especially when throwing together little proofs-of-concept.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜