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

Posted

in

, ,

by

Tags:

Comments

One response to “jQuery eq() typical mistake”

  1. jonceramic Avatar
    jonceramic

    This saved me today. Thank you!

Leave a Reply to jonceramic Cancel reply

Your email address will not be published. Required fields are marked *