jQuery each method
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>jQuery Closest Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "li" ).each(function( index, elem) { $("#result").append( index + ": " + $( elem ).text() ); }); }); </script> </head> <body> <ul> <li>First Item</li> <li>Second Item</li> <li>Third Item</li> </ul> <div id="result"></div> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery Closest Example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "li" ).each(function( index, elem) { $("#result").append( index + ": " + $( elem ).text() ); }); }); </script> </head> <body> <ul> <li>First Item</li> <li>Second Item</li> <li>Third Item</li> </ul> <div id="result"></div> </body> </html>
Copyrights@tutorialsplane.com