user2176592
user2176592

Reputation: 159

clear or reset all asp .net label's text value using jquery

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

Answers (1)

Chamika Sandamal
Chamika Sandamal

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

Related Questions