jQuery Interview Questions and Answers
A List of top and most frequently asked jQuery Interview Questions and Answers are given below:
What is jQuery ?
What are the features present in jQuery library ?
- DOM Manipulation
- HTML/CSS manipulation
- Event Handling
Will jQuery work in all browsers ?
What are the main advantages of using jQuery ?
- Cross-Browser support
- Event Handling
- Plugin support
- Lightweight and easy to use
- Faster DOM parsing
Explain jQuery Selectors ?
A Selector is a function that parses and finds the element in DOM based on the type.
Basically jQuery has 3 selectors as shown below:
|Tag Selector||$(‘p’).length||gets the count of |
all p tags in the DOM
|ID Selector||$(‘#interview’)||selects the id interview|
|Class Selector||$(‘.forums’)||selects all the elements|
with class name forums
What are Events in jQuery ?
In simpler words, events are the pieces of code that execute when something is triggered.
For Instance, if a function needs to be executed on a button click then we can add a click event to that button.
- Click – Mouse Event
- Keyup – Keyboard Event
- Focus – Form Event
- Load – Window Event
What is jQuery no conflict ?
jQuery noConflict is an option to overcome the conflicts when there are multiple frameworks use same shorthand identifier. In case of jQuery short hand identifier is “$”.
More about jQuery noConflict() – $.noConflict()
Brief the main difference between empty, remove and detach ?
|jQuery Empty removes all the child elements from the matched element.||jQuery Remove removes the matched element and its associated data.||jQuery Detach removes the matched element but doesn’t remove it’s data.|
What are different effects present in jQuery ?
- Display Effects
- Fading Effects
- Sliding Effects
- Other Effects
- Time Interval
What is the difference between $(this) and this in jQuery ?
Both this and $(this) refers to the same element but the only difference is that $(this) resolves into an object which can be used in functions.
What is Dough cookie plugin ?
Dough Cookie is a jQuery plugin used to do operations with cookies.
Example Cookie Operations:
Creating Cookie – $.dough(“cookie_name”, “cookie_value”);
Reading Cookie – $.dough(“cookie_name”);
Deleting Cookie – $.dough(“cookie_name”, “remove”);
What is jQuery Connect ?
jQuery Connect, is a plugin is used to connect a function with other function. It is basically binding of two functions.
List the selectors present in jQuery ?
- CSS Selector
- XPath Selector
- Custom Selector
Is jQuery compatible for server side scripting ?
No. jQuery is designed for client side scripting only. so it is not compatible or usable for server side scripting.
What is QUnit ?
QUnit, is a unit testing framework used by jQuery and it’s other libraries.
How to select all elements present in DOM using jQuery ?
We can select all the DOM elements with below line of code.
Above line of code results in total number of elements present in DOM. By using “*” all elements are highlighted/selected.
What is the alternative of “$” sign usage in jQuery ?
Instead of “$” sign, we can used “jQuery” as a function name as shown below.
Above 2 lines of code gives same result.
We will be bringing more jQuery interview questions and answers soon.
Thanks for visiting InterviewQuestionsBlog !!!!