Friday, August 22, 2008

jQuery eq() typical mistake

With all the open/close quote, you might write this code:
var i = 123;
$(":checkbox:eq(i)").removeAttr("disabled");
Since the selector string is within the quotes, the correct statement should be:
$(":checkbox:eq("+i+")").removeAttr("disabled");

Labels: , ,

0 Comments:

Post a Comment

<< Home