Replace "@[" in the string - Javascript String

Javascript examples for String:replace

Description

Replace "@[" in the string

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <p id="demo">this is a test! @[</p> 
      <button onclick="myFunction()">Try it</button> 
      <script>
function myFunction() {// w w  w .j  av a 2  s.c  o m
    var str = document.getElementById("demo").innerHTML;
    var res = str.replace(/@\[/g, "new value");
    document.getElementById("demo").innerHTML = res;
}

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

Related Tutorials