javascript - How to extract text from all elements of given class under given HTML element with jQuery -


when this:

var elem = $(".region_box"); text = elem.find(".my_text").html(); 

i can text first element deep below "elem" class "my_text" finds.

but there many elements of class "actual_text" below elem , want combine text of them. how it? new jquery , searched around solution long time, neither of them worked me. perhaps using each() function incorrectly. appreciate help.

you can use jquery.each

var text = '';  var elms = $(".region_box .my_text").each(function () {     text = text + $(this).text(); // use .html() if want html }); 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -