jQuery Lint Errors

1.4k Views Asked by At

I found out about jQuery Lint in the Firebug plugin. However its results are confusing and very hard to try and satisfy. I get hundreds of errors saying jQuery (...) called incorrectly.

For example this line comes up with that warning. What am i doing wrong here?

$('#myTextBox').val(someValue);

And when i try to remove all the rows from a tbody that has no rows it throws an error that stops all javascript on the page. It says no elements were found with that selector and then that remove is not a function.

$('#myTbody > tr').remove();

Do i really have to add extra code to work around this? How is jQuery Lint meant to be helpful?

1

There are 1 best solutions below

0
On BEST ANSWER

Here I made a simple example: jsfiddle.net/DJzFe/

There you will see that your 2 lines of code does not warn on jQuery Lint if you use jQuery 1.4.4, but I suspect that you are using jQuery 1.5.1 which hasn't been tested by jQuery Lint yet (it has been tested only with 1.3.2 and 1.4.4). And in 1.5.1 that statements will warn as you described: jQuery(...) called incorrectly