Daniel
Daniel

Reputation: 1357

jquery error: a function is not a function?

How is it possible that, being 'colonna' a simple string:

$('td.' + colonna).css('background-color','#ffddaa');

works correctly highlighting the background of the interesting cells, and:

$('td.' + colonna).contains('Catia').css('background-color','#ffddaa');

produces the error: "$('td.' + colonna).contains is not a function"?

Someone has an idea?

Thanks!

Upvotes: 1

Views: 1779

Answers (3)

Coderer
Coderer

Reputation: 27244

I know this is way (way!) past due, but I asked another question and it would appear that the net result is "old versions of JQuery had a .contains() method, but it has been deprecated." Yay for breaking your API!

Upvotes: 0

Benny Wong
Benny Wong

Reputation: 6851

I believe it should be something like:

$('td.' + colonna + ":contains('Catia')").css('background-color','#ffddaa');

Upvotes: 9

marcgg
marcgg

Reputation: 66436

I don't have the specific answer, but it sounds like you would gain a lot by using a good JS debugger. I'd recommand Firebug.

Explanations on how to use it here: http://getfirebug.com/js.html

Like this you will be able to see the DOM, the different functions availables. If it doesn't fix it you'll still be able to post a more precise question.

Sorry for not being more helpful

Upvotes: 0

Related Questions