Przemek Przemek - 1 year ago 52
Javascript Question

Jquery .html() of all elements

I have something like this

, but it apply only to first element that match it. I'd like to match value of all elements in document with class


You are selection all elements with class .class but to gather all html content you need to walk trough all of them:

var fullHtml;

$('.class').each(function() {
   fullHtml += $(this).html();

search items by containig text inside of it:

$('.class:contains("My Something to search")').each(function() {
   // do somethign with that