Reputation: 35
I need to add a class to this span in this line of code:
$(":text").after("<span>*</span>")
How do I add a class to this?
I have tried
$(":text").after("<span>*</span>").addClass("error");
and
$(":text").after('<span class="error">*</span>');
Upvotes: 0
Views: 28
Reputation: 4626
The <span>
should have a class?
How about
$(":text").after('<span class="myclass">*</span>');
note the switch to single quotes...
Upvotes: 1