Home  >  Article  >  Web Front-end  >  How to add content to an element in javascript_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-24 12:23:13932browse

JavaScript

For example:
I want to add a pair of 45a2772a6b6107b401db3c9b82c049c254bdf357c58b8a65c66d7c19c8e4d114,
to each character in a tag. For example, change about to 45a2772a6b6107b401db3c9b82c049c2 a54bdf357c58b8a65c66d7c19c8e4d11445a2772a6b6107b401db3c9b82c049c2b54bdf357c58b8a65c66d7c19c8e4d11445a2772a6b6107b401db3c9b82c049c2o54bdf357c58b8a65c66d7c19c8e4d114u45a2772a6b6107b401db3c9b82c049c2t54bdf357c58b8a65c66d7c19c8e4d114
<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>


That’s what I thought,
However, what should we do if there are 0c6dc11e160d3b678d68754cc175188a or e388a4556c0f65e1904146cc1a846bee, 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);

Reply to discussion (solution)

You can first filter out "0c6dc11e160d3b678d68754cc175188a or e388a4556c0f65e1904146cc1a846bee, spaces,  ..."

You can first filter out "0c6dc11e160d3b678d68754cc175188a or e388a4556c0f65e1904146cc1a846bee, spaces,  ..."

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


To keep the style unchanged

076402276aae5dbec7f672f8f4e5cc81,e388a4556c0f65e1904146cc1a846bee, What style changes will result



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

Statement:
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