Yes, we can select an element with a specific class, we use the class selector.The class name must contain the prefix as "." (dot).
$(".class1").css("border", "2px solid red");
Above code will select all the elements of the webpage containing the class as "class1" and apply the css style border width as 2 Pixel, style as solid and color as red.
Asked In: Many Interviews |