How to use js to splice html strings

不言
Release: 2018-06-09 16:12:40
Original
5223 people have browsed it

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=&#39;<li class="todetail" data-id="&#39;+
	one.id+&#39;"><p class="dd_time">&#39;+
	one.leasetime+&#39;</p><p class="info-box"><img src="&#39;+
	fe+&#39;" class="dd_face"></p><p class="dd_bot"><span class="dd_nikename">&#39;+
	nikeme+&#39;</span><p class="money"><span class="dd_price">¥&#39;+
	one.ney+&#39;</span></p></p><p class="dd_do"><span>约会:&#39;+
	one.myhuifangshi+&#39;</span></p><p class="dd_zt">状态:&#39;+
	zt+&#39;</p><p class="code_btn">&#39;+
	buttons+&#39;</p></li>&#39;;
Copy after login

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!

Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template