How do I remove HTML that I place dynamically with JQuery
Posted
by
Vivek
on Stack Overflow
See other posts from Stack Overflow
or by Vivek
Published on 2011-01-14T12:51:50Z
Indexed on
2011/01/14
13:53 UTC
Read the original article
Hit count: 256
lets say i have fallowing html...
<li><a href="#" id='DataSheets' >Data Sheets</a><font class="leftNavHitsFont">- (1)</font></li>
<li><a href="#" id='ApplicationNotes' >Application Notes</a><fontclass="leftNavHitsFont">- (6)</font></li>
what i want to do is, add a html on onclick of these links, if you click on first link output should look like
<li><span>ajksdfskaj</span></li>
<li><a href="#" id='ApplicationNotes' >Application Notes</a><fontclass="leftNavHitsFont">- (6)</font></li>
means hide the original html of that li and append new html for ex. a span as i have written above...and if i clicked on second link the first li should get it's original html and appended html should get removed and get appended to current li bieng clicked..in this case output should look like...
<li><a href="#" id='DataSheets' >Data Sheets</a><font class="leftNavHitsFont">- (1)</font></li>
<li><span>ajksdfskaj</span></li>
i tried to achieve this thing through variuos way...but could not find out the correct way..
please help me out guys..
Thanks in advance!!!!
© Stack Overflow or respective owner