javascript - Got runtime error, when inserting list item <li> in to a paragraph <p> tag -


look @ following code example:

<%@ page title="home page" language="c#" autoeventwireup="true"  codebehind="default.aspx.cs" inherits="webapplication18._default" %>  <!doctype html> <html> <body>     <p id="someid"></p>      <script type="text/javascript">         document.getelementbyid("someid").innerhtml = "<ul><li>some content</li></ul>";     </script> </body> 

in visual studio 2013, debug mode, got runtime error. have noticed p tag doesn't allow block-level tags within according w3c rules.

but if created static html file, runs fine.

<!doctype html> <html>     <body>     <p id="someid"></p>     <script type="text/javascript">         document.getelementbyid("someid").innerhtml = "<ul><li>some content</li></ul>";     </script>  </body> </html> 

i wonder why there runtime error when running visual studio, it’s ok static file? thanks. using visual studio 2013, , ie 11.

html in general more forgiving. semantically it's not correct. vs complains because don't follow rules.

usually somewhere in tools > options >

  • text editor >
    • html > advanced
    • html (web forms) > validation
    • javascript > intellisense (?)

any indication in error pane?


Popular posts from this blog