Javascript examples for jQuery:String
Get last section of string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function(){// w w w. ja v a 2 s . c om $('input').each( function(){ var string = this.name; $(this).val(string.substring(string.lastIndexOf('[') + 1,string.length - 1)); }); }); </script> </head> <body> <input id="inputElem" name="somestring[subkey][subkey2]"> </body> </html>