Using jQuery, how do I apply a given function to each word in a paragraph?

Question by : Using jQuery, how do I apply a given function to each word in a paragraph?
I want to compare each word to a regular expression, if they match then do some more code.

Best answer:

Answer by Julijan
You can use the jquery’s each to iterate trough all

elements…

$ (‘p’).each(function() {
if (//.test($ (this).text())) {…}
});

What do you think? Answer below!

No related content found.

Revisions

There are no revisions for this post.

Tags: , , , , , , ,

No comments yet.

Leave a Reply