0 Scarlett posted Get the text from all elements with the same class <div class="menu">Home</div> <div class="menu">Categories</div> <div class="menu">Contact us</div> <div class="menu">About us</div> how to get the text from all elements with the same class Edit Question
0 shabi answered Jun 10 '21 00:00 following code will get all text with given class function getText(classname){ var text =[]; $("."+classname).each(function(){ text[text.length]=$(this).text(); }); return text; } getText("menu"); will return all texts in array Edit Answer