1

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!

3 Answers 3

9

I believe it should be something like:

$('td.' + colonna + ":contains('Catia')").css('background-color','#ffddaa');
Sign up to request clarification or add additional context in comments.

1 Comment

I'm confused because of this: docs.jquery.com/Traversing/contains I have been learning jQuery through "jQuery in Action" (too lazy to look up a link; it's a popular book though) and in my Oct. 2008 edition on p.45 they list a "contains" function. Both their example, and the one I linked to above from the jQuery docs, generate the OP's error ("not a function"). Did there used to be a .contains function that maybe got removed? Or did it get added after 1.2.1, the version used in the book's sample code?
0

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

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.