Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

jQuery syntax

Notes:

jQuery Syntax :

jQuery(expression).action(parameters);
OR
$(expression).action(parameters);

jQuery(expression) or $(expression):
Used to query or select or target HTML element(s),
based on the given expression, it selects and returns an array of all matching HTML element(s).

expression:
can be a “CSS selector“ , or JS object for selection
can also pass JS function for execution
can also pass “html code” to create elements dynamically at runtime

action(parameters):
can be another jQuery method (function)
indicates the action to be performed on selected HTML element(s),

parameters:
indicate the requirements of the action
Ex:
JQuery("#headingone").css("border","2px solid red");
OR
$("#headingone").css("border","2px solid red");

It selects any html element whose id attribute value is set to headingone and applies the CSS style 2px solid red border.

Interview Questions: