I have a table in my page that has changing innerHTML. I need my function to be able to remove an html tag and its contents from within the div. The tag will look like this:
[CODE]<!-RN#-><tr><td>bla bla bla bla bla</td></tr><!-ERN#->
With a varying # after the RN. For example, it may be RN3 or RN5, etc. The # is supplied by the function’s argument. Here is what I have so far:
[CODE]function removeit(rnum) {
re = new RegExp(“<!-RN”+rnum+”->.+<!-ERN”+rnum+”->”,”m”);
document.getElementById(‘thetable’).innerHTML = document.getElementById(‘thetable’).innerHTML.replace(re,””);
//This is for debugging. Displays the regular expression
document.getElementById(‘debugdiv’).innerHTML = ‘The regular expression is ‘+re;
}
However, it does not remove the tag and its contents from the innerHTML. Any ideas what I am doing wrong?
Thanks