Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create a dynamic div element in my web page.
My div.id is 'codeDiv'.
There are a lot of elements('a href, button, select, etc.') to my div element.

How can i clear the all elements('a href, button, select, etc.') from my created dynamic div element using java scripts????

please help me anybody.....
Posted
Comments
Rajeev Jayaram 18-Oct-12 8:32am    
Are you using jQuery?. If not, consider using jQuery. See my answer.

I suggest you to consider jQuery,
JavaScript
$('#codeDiv').empty();

Hope it helps!
 
Share this answer
 
If you're not using jQuery, you can do this in plain Javascript:
JavaScript
document.getElementById('codeDiv').innerHTML = '';
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900