jQuery: remove several words with .remove and :contains

Hi,

I’m currently reading jQuery - Novice to Ninja (fantastic book), and trying to understand how I can add several words to the code snippet below. I currently remove, let’s say Sweden as below, but what if I also want to remove Norway?

And another question, what if I would like to keep only Sweden and remove the rest from a list of twenty countries? How would I do that?

jQuery(document).ready(function() {
	jQuery('#countries tbody').remove(':contains("Sweden")');
});

It might be easier to do it without jQuery.

Can you post an example of the string, or whatever, you are trying to remove words from.

This may be helpful. http://api.jquery.com/attribute-not-equal-selector/

I’m currently reading jQuery - Novice to Ninja (fantastic book)

You have to be kidding me. The first three chapters contain enough errors that I would return the book if I could. Check my last few posts for some enlightenment.

webdev1958: Yeah, it would be better just to get the correct data from the database with PHP, but it’s a plugin for Wordpress and my PHP skills are zero. So it will be hard, but I will look into that as soon as I learn more.

RyanKing1809: The not selector worked out here. Need to learn more about that one.

7stud: Well, since I don’t know any JS prior to reading this book, it seems fantastic to me. I like the way it’s presented, and not like the JS book I have in a course right now which isn’t very good learning material. Code errors? Might be, and I’ll probably discover them later on. :slight_smile: