<!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("#rewrite").click(function(){ var regex=/\.*[:]\S*/ var originalHtml = $('#editableDiv').html(); var newHtml = originalHtml.replace(regex,"sleeping"); $('#editableDiv').html(newHtml); }); }); </script> </head> <body> <form name="myform"> <div id="editableDiv" contenteditable="true"> the quick <b><i>brown</i></b> fox jumps over a <b><i>:lazy </i></b>dog </div> <input type="button" id="rewrite" value="Rewrite"> </form> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)