I am trying to get and array of text after using the text function, having a ul list like
<ul> <li>one <ul> <li>one one</li> <li>one two</li> </ul> </li> </ul>
then get something like
['one', 'one one', 'one two']
var array = $('li').map(function(){ return $.trim($(this).text()); }).get();
http://api.jquery.com/map/
Demo Fiddle --> http://jsfiddle.net/EC4yq/
-->
2.1m questions
2.1m answers
60 comments
57.0k users