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");

Comments (1)

  1. 10:24 pm, March 17, 2010jonceramic  / Reply

    This saved me today. Thank you!

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.