Answer: Yes, we can select an element with a specific class, we use the class selector.The class name must contain the prefix as "." (dot).
<script language="javascript" type="text/javascript">
$(".class1").css("border", "2px solid red");
</script>
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 |
Alert Moderator