Word presence check

var checkWord = function(word){ $('.phrase').each(function() { var content = $(this).html(); if(content.indexOf(word) != -1){ console.log(word + ' is present'); } else { console.log(word + ' is not present'); } }); }; checkWord("chicken"); // todo : check multiple words
Function to check if a certain word is present.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.