The following editor will bring you a note on js splicing html strings. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
After adding the splicing, if there is no line break, the execution will not be executed one by one. However, the string is too long. After the line break, the execution will be executed one by one. This way The p generated by the page is not the desired result.
Line breaks should be spliced like this
var s='<li class="todetail" data-id="'+ one.id+'"><p class="dd_time">'+ one.leasetime+'</p><p class="info-box"><img src="'+ fe+'" class="dd_face"></p><p class="dd_bot"><span class="dd_nikename">'+ nikeme+'</span><p class="money"><span class="dd_price">¥'+ one.ney+'</span></p></p><p class="dd_do"><span>约会:'+ one.myhuifangshi+'</span></p><p class="dd_zt">状态:'+ zt+'</p><p class="code_btn">'+ buttons+'</p></li>';
s=' ccccccc '
XX 'cccccccccccccccc'
XX 'ccccccccccccccccccc';
The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
How to use DOM in JS to control HTML elements
JS implements changing the text color and Content method
The above is the detailed content of How to use js to splice html strings. For more information, please follow other related articles on the PHP Chinese website!