Remove the elements and contents before an element
- by Jerry
Hello guys
I am trying to remove the elements and contents
before a link inside a div when a user clicks a button.
What is the best way to do it??
<div id="dialog" class="window">
//will be inserted a <select> element and few text here
//but I want to clear them after the user click a button
<a href="#" class="close">Close it</a> // I want to keep this <a> link.
</div>
My Jquery
$('.model').click(function(e) {
$("#dialog").empty(); //I can't use this because <a> will be deleted. Any better ideas?
});
Thanks for the reply...