JQuery search replace string - Javascript jQuery

Javascript examples for jQuery:String

Description

JQuery search replace string

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.8.3.js"></script> 
  <script type="text/javascript">
    $(function(){/*from   w ww .  j  a v a 2 s  .  co  m*/
var name = 'field[subform][0][subsubform][2][name]';
var firstStr = name.split('][').slice(0,-2);
var secStr = name.split('][').slice(-2);
secStr[0] = +secStr[0] +1;
console.log(firstStr.concat(secStr).join(']['));
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials