For loop or foreach in jQuery

Thursday, January 26, 2012

Just add reference to the jQuery library and execute the below script.
I have read all text inside the list tag.

<script>
$(document).ready(function(){

$("li").each(function(){
alert($(this).text());
});

});
</script>

<ul>
<li>testers</li>
<li>test</li>
<li>testing</li>
<li>coding</li>
<li>Internal</li>
</ul>

0 comments:

Post a Comment