Creating a
with javascript createElement?

后端 未结 5 728
终归单人心
终归单人心 2020-12-30 19:41

I need to create a
tag dynamically with javascript.

var br = document.createElement(\'br\');

And

         


        
5条回答
  •  旧时难觅i
    2020-12-30 20:00

    This question has nothing whatever to do with markup. The argument passed to createElement is an element name, it is not a fragment of markup or anything else, it isn't XML, or HTML, or XHTML, or SGML or any form of markup.

    The createElement method returns a DOM object, there is no markup and never was.

    Note that the markup passed to the browser is used to create a document object, from that point onward, the markup is irrelevant.

提交回复
热议问题