Przemek Przemek - 1 year ago 91
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

Answer Source

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download