Get option value with match in jQuery - Javascript jQuery

Javascript examples for jQuery:Select Dropdown

Description

Get option value with match in jQuery

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from   ww w .j ava  2s.  com*/
console.log($('#my option').filter(":selected").val().match(/^\d+/));
    });

      </script> 
 </head> 
 <body> 
  <select name="my" id="my"> <option value="702(3)">test - (123 3 1234)</option> </select>  
 </body>
</html>

Related Tutorials