How to find all h1 and add a class to it using Jquery
I have to find all h1 tags in a html page and add a class which has color red to them
My class is ass follows:
.error{
color:red;
}
Answers (1)
Add AnswerYou can use Below code
$(“body”).find(“h1”).addClass(‘error’)
jQuery(‘h1’).addClass(“error”);