Get the key of a multi dimensional select box using jQuery - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Get the key of a multi dimensional select box using jQuery

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <select id="my" class="myclass" name="start_time[195]"></select> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
      <script>
    $(document).ready(function(){
        var name = $("#my").attr("name");
        var patt = /\d+/g;// w w  w .  j a  v  a 2s. co m
        var value = name.match(patt);
        console.log(value);
    })
    
      </script>  
   </body>
</html>

Related Tutorials