function globalSearch(myString){ var allElements = $('*').not('.block_C'); allElements.each(function(){ if($(this).text() == myString) { $('.block_C').prepend('<p>' + myString + '</p>'); } }) }