Your Ad Here

Posted By

anvilcity on 12/18/10


Tagged

jquery


Versions (?)

Get an array of list element contents in jQuery


 / Published in: jQuery
 

URL: http://stackoverflow.com/questions/247023/get-an-array-of-list-element-contents-in-jquery/247057#247057

  1. var optionTexts = [];
  2. $("ul li").each(function() { optionTexts.push($(this).text()) });
  3.  
  4. To join the results:
  5.  
  6. var quotedCSV = '"' + optionTexts.join('", "') + '"';

Report this snippet  

You need to login to post a comment.