jQuery gets wrong html() for span after a p tag -


<html> <head> <script      src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"      type="text/javascript"/></script> <script> $(function() {     alert($('#s1').html()); }); </script> </head> <body> <p/> <span id="s1"><h3>eggs</h3>one dozen please</span> </body> </html> 

this page puts blank alert <p> tag, <br> shows '<h3>eggs</h3>one dozen please', i'd expected.

this appears case firefox 12.0 , chrome 19.0. ie8 gets right. ideas might happening?

the / has no meaning, @ least not in html5. have:

<p>   <span id="s1"><h3>eggs</h3>one dozen please</span> 

since <p> cannot contain <h3>, browser tries make @ least sense out of interpreting as:

<p>   <span id="s1"></span> </p> <h3>eggs</h3>one dozen please 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -