Is it possible to clear all asp:PlaceHolder
controls on client side using JavaScript?
Something like: placeHolder.Controls.Clear()
- but this is on server side.
Is it possible to clear all asp:PlaceHolder
controls on client side using JavaScript?
Something like: placeHolder.Controls.Clear()
- but this is on server side.
you can use following jQuery code:
$("#placeHolder").html("");
Not elegant, but works. Surround your PlaceHolder with another div:
<div id="masterDiv">
<asp:PlaceHolder runat="server" ID="placeHolder1" >
Some stuff
<input type="text" />
<input type="submit" value="Don't click!" />
</asp:PlaceHolder>
</div>
If you can use jQuery, then use the empty function or html('')
$('#masterDiv').empty();
Or
$('#masterDiv').html('');
If you must use JavaScript, then do same:
document.getElementById('masterDiv').innerHTML = "";