jQuery > Selectors

ID Selectors("#id") in jQuery

How to select an element having a specific id ?


To select an element having a specific id, ID selector can be used. We need to prefix the id with “#” (hash symbol). 

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

Above code will select all html elements having id attribute as “p1” and apply css style border width as 5 pixel, style as solid and color as green. 

 Views: 6932 | Post Order: 13



Write for us






Hosting Recommendations