21. Why is jQuery library used for client scripting?Answer:
jQuery is a client scripting. It helps to build robust and modern web applications in very short span of time.
It executes inside your browser when you request a page.
22. Which method is used to set one or more style properties for selected elements in jQuery?Answer:
In jQuery, CSS() method is used to set one or more style properties for selected elements.
This method sets or returns one or more style properties for the selected elements.
CSS() method helps to get the value of a computed style property for the first element in the set of matched elements or set one or more CSS properties for every matched element.
<button>Change Text Color</button>
23. Which function is used to prevent code from running, before the document is finished loading?Answer:
The onload event is used to prevent code from running, before the document is finished loading.
This event occurs when an object has been loaded.
It is most often used within the <body> tag to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.).
This event can be used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information.
<img src="/home/careerride2/Downloads/download.jpg" onload="loadImage()" width="500" height="600">
alert("Image is loaded");
24. Which method is used to switch between adding/removing one or more classes (for CSS) from selected elements?Answer:
The switchClass method is used to adds and removes the specified classes to each of the set of matched elements while animating all style changes.
This method is used to move from one CSS class to another CSS class, animating the transition from one state to another state.
.switchClass( removeClassName, addClassName [, options ] )
This parameter is a string. It represents the CSS class name or space demarcated list of class names, to be removed.
This parameter is of type string. It represents one or more class names which are added to the class attribute of each matched element.
It is used to specify all animation settings. All properties are optional. Its possible values are:
This is a string or number. It specifies how long the animation will run. Its default value is 400.
It is a string which specifies the easing function used for transition. Its default value is swing.
It is a callback method called for each element when the effect is completed for this element.
This is a Boolean type. It specifies whether the animation should additionally be applied to all descendants of the matched elements. Its default value is FALSE.
This is of Boolean type or string type. It specifies whether to place the animation in the effects queue. Its default value is TRUE.
25. What are the advantages of CDN?Answer:
CDN reduces the load from the server.
If a user regularly visits a site which is using jQuery frameworks from any of these CDN, it will be cached.
CDN saves bandwidth. jQuery framework is loaded faster from these CDN.
It reduces existing hosting cost and increases the performance.
CDN gives fast response time in delivering content to end users.