Select fields with names - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Select fields with names

Demo Code

ResultView the demo in separate window

<html>
   <head>
      <script src="https://code.jquery.com/jquery-1.7.1.min.js"></script> 
      <script>
$(document).ready(function(){
    $('input[name^="employee[name]"]').each(function() {
            console.log($(this).val());
    });//w  w w.ja va 2s  .  c  o  m
});

      </script> 
   </head>
   <body> 
      <form> 
         <input type="text" name="employee[name][]" value="value1"> 
         <input type="text" name="employee[name][]" value="value2"> 
      </form>  
   </body>
</html>

Related Tutorials