Want to Replace Some JavaScript with a String -
i have text like
lorem ipsum dolor sit amet, consectetuer adipiscing elit. donec condimentum pretium nisl. integer quis tellus nec turpis placerat scelerisque.
and have javascript like
<script language="javascript1.1" src="http://www.example.com?id=123&msg=how you"></script>
this script string me. how can replace js adipiscing
my output should this:
lorem ipsum dolor sit amet, consectetuer < script language="javascript1.1" src="http://www.example.com?id=123&msg=how you">< /script> elit. donec condimentum pretium nisl. integer quis tellus nec turpis placerat scelerisque.
please, let me know javascript problem.
var startingtext = "lorem ipsum dolor sit amet, consectetuer adipiscing elit. donec condimentum pretium nisl. integer quis tellus nec turpis placerat scelerisque."; var jstext = "<script language=\"javascript1.1\" src=\"http://www.example.com?id=123&msg=how%20are%20you\"></script>"; var endingtext = startingtext.replace("adipiscing",jstext);
edit: trying create jsfiddle show working example, reason it's detecting script tags inside js string , refusing work properly.
second edit: http://jsfiddle.net/jmwqm/
Comments
Post a Comment