Modifying DOM of a webpage
Posted
by
Prashant Singh
on Stack Overflow
See other posts from Stack Overflow
or by Prashant Singh
Published on 2012-12-06T04:55:47Z
Indexed on
2012/12/06
5:03 UTC
Read the original article
Hit count: 184
JavaScript
|dom
The structure of a webpage is like this :-
<div id='abc'>
<div class='a'>Some contents here </div>
<div class='b'>Some other contents< </div>
</div>
My aim is to add this after the class a in above structure.
<div class='a'>Some other contents here </div>
So that final structure looks like this :-
<div id='abc'>
<div class='a'>Some contents here </div>
<div class='a'>Some other contents here </div>
<div class='b'>Some other contents< </div>
</div>
Can there be a better way to do this using DOM properties. I was thinking of naive way of parsing the content and updating.
Please comment if I am unclear in asking my doubt !
© Stack Overflow or respective owner