jQuery > Selectors

Class Selector (“.class”) in jQuery

How to select a particular element having a specific class?


To select an element with a specific class, class selector can be used. We need to prefix the class name with “.” (dot). 

<script language="javascript" type="text/javascript">
$(".class1").css("border", "5px solid green");
</script>

Above code will select all elements of the web page having class as “class1” and apply css style border width as 5 pixel, style as solid and color as green. 

 Views: 7227 | Post Order: 11



Write for us






Hosting Recommendations