issue with innerHTML
i have a problem with innerHTML
if i wrote
document.getElementById('someid').innerHTML = "ok";
then it wroks
but when i wrote
document.getElementById('someid').innerHTML = "<sometext> ok";
it does not work.
i.e. <sometext> is not visible
if check on firebug / dom it display..
<sometext> ok </sometext>
how do i print / display above string as it as.
you may download file or check below link..
please click here
The problem is the page thinks your posting an HTML element, to avoid this you will need to convert the string so < and > for example get converted to HTMLEntities. See the following link for a quick and painless way to do this:
this might not work.. in above case <b> or <i> or <font> tags does not work.
if you want "<sometext>" to be visible, then use .innerText instead of .innerHtml