Reputation: 159
How to clear or reset ALL asp.net label's text value on web page dynamically by finding them without using id
I am finding and setting the text for textbox fields as $('.divclassname').find('input:text, input:password, input:file, textarea').val('');
so how can I do this for ASP:LABEL controls
Upvotes: 0
Views: 3729
Reputation: 24312
<asp:label />
will render as a <label/>
if it is bind to any input field(set for attribute), otherwise it will render as <span/>
So it is not good practice to remove all the label text or span texts. if you want to do so $("label").empty()
will do the job. but I would suggest you to use a css class for all the <asp:label />
tags and cleat text using following code
$(".className").empty();
Upvotes: 2