Is it expected that jQuery $('span').html() turns XHTML br tag to html syntax?

前端 未结 3 987
借酒劲吻你
借酒劲吻你 2020-12-11 05:45

If I have a span tag like this:

 Hi
SecondLine

And I call this jQuery function:

 var ht         


        
3条回答
  •  星月不相逢
    2020-12-11 06:34

    It doesn't. It just modifies the browser DOM.

    It is up to the browser to serialise the DOM to HTML or XHTML as it desires when using innerHTML. Different browsers act differently.

提交回复
热议问题