jQuery accepts a string enclosed with double quote (“”) that can contain a CSS selector which is used to match a set of elements on the web page.
jQuery code can start with either “jQuery” word or a “$” (dollar symbol). Take a look at below code snippet
<script language="javascript" type="text/javascript">
$(function () {
jQuery("#div1").css("border", "2px solid red");
});
</script>
OR
<script language="javascript" type="text/javascript">
$(function () {
$("#div1").css("border", "2px solid green");
});
</script>
Both above code snippets are functionally same and do the same thing. So you can either user jQuery or $ when you are writing jQuery code.
Views: 7306 | Post Order: 8