P
PaPa
I'm not sure this is a javascript issue or an HTML issue. I notice
that when I extract the contents of a div using the innerHTML property
(?), that I wind up with a literal variable (?) which exactly matches
the contents of the div with one exception.
It seems that whenever the code includes a tag which uses the forward
slash against the closing bracket (say the break tag ..... />) that
the browser, or HTML, or javascript, or something else, removes the
forward slash.
I've tried this on safari, chrome, mozilla, and IE and they all seem
to do the same thing.
Can someone tell my why this is happening and if there is a way to get
around it?
Regards,
PaPa
Here is some code which demonstrates the issue.
<body >
<div id="test1">
<p>This is a test to see if the / symbol is recreated here </p>
<p> now we will add a break tag </p><br />
</div>
<script type="text/javascript">
var lit=document.getElementById("test1").innerHTML;
alert(lit);
</script>
</body>
In the alert box, you should see all the forward slashes in the
"test1" div, except for the forward slash in the br tag.
that when I extract the contents of a div using the innerHTML property
(?), that I wind up with a literal variable (?) which exactly matches
the contents of the div with one exception.
It seems that whenever the code includes a tag which uses the forward
slash against the closing bracket (say the break tag ..... />) that
the browser, or HTML, or javascript, or something else, removes the
forward slash.
I've tried this on safari, chrome, mozilla, and IE and they all seem
to do the same thing.
Can someone tell my why this is happening and if there is a way to get
around it?
Regards,
PaPa
Here is some code which demonstrates the issue.
<body >
<div id="test1">
<p>This is a test to see if the / symbol is recreated here </p>
<p> now we will add a break tag </p><br />
</div>
<script type="text/javascript">
var lit=document.getElementById("test1").innerHTML;
alert(lit);
</script>
</body>
In the alert box, you should see all the forward slashes in the
"test1" div, except for the forward slash in the br tag.