Sunday, June 14, 2009

How to Replace All in Javascript

How to replace all string using javascript replace function... Here is simple example replace all in javascript in replace string method.

CODE:
  <Script Language="javascript">  
var str = "This is the test string.";
var rs = str.replace(/is/g,"");
document.write(st); // result "Th the test string."
</Script>

No comments:

Post a Comment