Create string from HTMLDivElement

前端 未结 6 1673
醉酒成梦
醉酒成梦 2020-12-29 06:27

What I would like to be able to do is create a string from a Javascript HTMLElement Object. For example:

var day = document.createElement(\"div\");
day.class         


        
6条回答
  •  甜味超标
    2020-12-29 06:56

    Why would you use createElement if you can also directly parse a string? Like: var string = '

    ' + text + '
    ';

提交回复
热议问题