jquery - Find Length of Div -


how find no. of elements present in div?? want print list of element present in div . have tried not working ..

<!doctype html> <html> <head> <title> div length</title> <script type="text/javascript" src="js/jquery-1.6.2.min.js">  </script> <script>     $(function ()     {     alert(' elements ' +$('#main').length);      }     ) </script>  </head>  <body>  <div id="main">  <img src="images/thumb1.jpg"; height="30" width="30" /> <img src="images/thumb2.jpg"; height="30" width="30"/> <img src="images/thumb3.jpg"; height="30" width="30"/> <img src="images/thumb4.jpg"; height="30" width="30"/> <div id="main1">  </div>  <div id="main2">  </div>   </div> </body>  </html> 

i need find length because dynamical adding element in div j query @ end want check elements has been added .

thanks,

$("div#main").children().length


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -