Find and Display all Text Boxes's Values using JQuery

  1. <html  
  2.     xmlns="http://www.w3.org/1999/xhtml">  
  3.     <head runat="server">  
  4.         <title></title>  
  5.         <script src="Scripts/jquery-1.8.2.js"></script>  
  6.         <script>  
  7. function GetText() {  
  8. $('li input:text').each(function (i, el) {  
  9. console.log($(this).closest('li').find('input:text').val());  
  10. });  
  11. }  
  12. </script>  
  13.     </head>  
  14.     <body>  
  15.         <form id="form1" runat="server">  
  16.             <div id="divText">  
  17.                 <ul>  
  18.                     <li>  
  19.                         <input type="text" />  
  20.                     </li>  
  21.                     <li>  
  22.                         <input type="text" />  
  23.                     </li>  
  24.                     <li>  
  25.                         <input type="text" />  
  26.                     </li>  
  27.                     <li>  
  28.                         <input type="text" />  
  29.                     </li>  
  30.                     <li>  
  31.                         <input type="text" />  
  32.                     </li>  
  33.                 </ul>  
  34.                 <input type="button" value="Click Me" onclick="GetText();"/>  
  35.             </div>  
  36.         </form>  
  37.     </body>  
  38. </html>