javascript - Finding Specific text in body and removing it via JS -
i creating html , aspx file via c# code in apx works fine in html page appends aspx tag shows plain text in body. want remove text in body starts <%
, ends %>
here generated html
<body> <center> <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %> <div> <form> // input fields , submit button </form> </div> </center> </body>
i have tried
document.body.innerhtml = document.body.innerhtml.replace( <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %>, "");
but didn't work me, generated aspx tag not same time..
in code:
document.body.innerhtml = document.body.innerhtml .replace( <%string action = "http://" + request.url.authority+"/abc/data/a12.aspx" ; %>, "");
you are: not using string first argument, invalid.
i suggest use regex, matches <% [anything] %>.
like this:
document.body.innerhtml = document.body.innerhtml .replace(/<%.*%>/g, "");
Comments
Post a Comment