get all elements contained by a div with given name - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:append

Description

get all elements contained by a div with given name

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.6.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from  w  ww  .j a v  a2 s  . c  o  m
inputs=$('input')
for (input in inputs){
    $('ul').append('<li>'+input+((!isNaN(input))?'<b>&lt;--this is an input-element</b>':'')+'</li>');
    }
    });

      </script> 
 </head> 
 <body> 
  <ul></ul> 
  <input> 
  <input>  
 </body>
</html>

Related Tutorials