How to add content to an element in javascript_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:23:13
Original
938 people have browsed it

JavaScript

For example:
I want to add a pair of ,
to each character in a tag. For example, change about to about
<div style="position:absolute; left:40%;" >	  		<div>	  			<br><br><strong>②</strong> 	  			<p id="pp1">T makes ss talk about the question. Then, T lets them copy each others' body language and share feelings </p>	  			<p id="pp2">about them.</p></td>   	  		</div><div>	  			********************.	  		</div>	  	</div>
Copy after login


That’s what I thought,
However, what should we do if there are
or

, spaces, , etc. in the tag?

var str = obj.text();				for(var i=0; i<str.len-1; i++){					s += "<span id=G_0"+index+">" + str.substring(i, i+1) +"</span>" ;			index++;}obj.html(s);
Copy after login

Reply to discussion (solution)

You can first filter out "
or

, spaces,  ..."

You can first filter out "
or

, spaces,  ..."

Then how to add it back according to the original style?


To keep the style unchanged


,

, What style changes will result


, What kind of style change will it cause?

I know, because the selection is not the lowest element~Thank you

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