Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using jQuery to set value on SPAN element

I have an element <span id="userName.errors" class="errors">Enter Your User Name </span> i would like to use jquery to remove the text 'Enter Your User Name ' or any element that belongs to the class 'errors'

like image 669
devdar Avatar asked Mar 19 '26 13:03

devdar


1 Answers

Use the text method:

$(".errors").text("New text here");

This targets all elements with the class "errors".

like image 137
Sampson Avatar answered Mar 21 '26 02:03

Sampson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!