jQuery Interview Questions and Answers

jquery interview questions
Advertisements

A List of top and most frequently asked jQuery Interview Questions and Answers are given below:

What is jQuery ?

jQuery, is a lightweight JavaScript Library. jQuery is meant to make JavaScript easier to use in the website. jQuery simplifies the complexity between DOM and JavaScript.

What are the features present in jQuery library ?

  • DOM Manipulation
  • HTML/CSS manipulation
  • Event Handling
  • Transitions
  • Ajax
  • Plugins

Will jQuery work in all browsers ?

jQuery is nothing much different than JavaScript, it’s just a library using JavaScript. Since, JavaScript is supported in all browsers same applies for jQuery too.

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:

SelectorSyntaxExplanation
Tag Selector$(‘p’).lengthgets 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
jQuery Selectors

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.

Example Events:

  • 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 ?

EmptyRemoveDetach
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.
$(selector).empty();$(selector).remove();$(selector).detach();
Empty vs Remove vs Detach

What are different effects present in jQuery ?

  • Display Effects
    • Show
    • Hide
    • toggle
  • Fading Effects
    • fadeIn
    • fadeOut
    • fadeToggle
    • fadeTo
  • Sliding Effects
    • slideDown
    • slideUp
    • slideToggle
  • Other Effects
    • Animate
    • Delay
    • Timeout
    • Time Interval
    • Stop

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.

$('*').length

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.

$("*").length
jQuery("*").length

Above 2 lines of code gives same result.

We will be bringing more jQuery interview questions and answers soon.

Thanks for visiting InterviewQuestionsBlog !!!!

Related Links:

HTML Interview Questions

CSS Interview Questions

Leave a Reply

Exit mobile version