Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQuery Interview Questions and Answers

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQuery interview questions

  1. What is jQuery ?
    jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM) and JavaScript.
    Elaborating the terms, jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser JavaScript development.
  2.     

  3. Does jQuery HTML work for both HTML and XML documents ?
    No, JQuery HTML doesn’t work with XML document. It only works for HTML documents.
  4.     

  5. What are jQuery Selectors ? Give some examples.
    jQuery selectors are used to select the HTML elements and allows you to manipulate the HTML elements in a way we want. It selects the HTML elements on a variable parameter such as their name, classes, id, types, attributes, attribute values, etc. All selectors in jQuery are selected using a special sign i.e. dollar sign and parentheses:

    $("selector-name")
    • Elements Selector: The elements selector selects the element on the basis of its name.
      Example:

      $("h1")
    • Id Selector: The id selector selects the element on the basis of its id.
      Example:

      $("#gfg")
    • Class Selector: The class selector selects the element on the basis of its class.
      Example:

      $(".GFG")
  6.     

  7. What are the advantages of jQuery ?
    • It contains wide range of plug-ins. jQuery allows developers to create plug-ins on top of the JavaScript library.
    • Large development community.
    • It has a good and comprehensive documentation.
    • It contains lots of JavaScript library and it is easy to use compared to the standard JavaScript.
    • jQuery lets users develop Ajax templates with ease, Ajax enables a sleeker interface where actions can be performed on pages without requiring the entire page to be reloaded.
    • Being lightweight and a powerful chaining capability makes jQuery more strong.
  8.     

  9. What are the methods used to provide effects?
    Some of methods are listed below which provides the effect:

  10.     

  11. Difference between .empty(), .remove() and, .detach() in Jquery ?
    • jQuery empty() Method: The empty() method in jQuery is used to remove all child nodes and its content for the selected elements.
    • jQuery remove() Method: The remove() method in JQuery is used to remove all the selected elements including all the text. This method also remove data and all the events of the selected elements.
    • jQuery detach() Method: The detach() method in jQuery is used to remove the selected elements from the DOM tree including its all text and child nodes but it keeps the data and the events. Document Object Model (DOM) is a World Wide Web Consortium standard. This defines for accessing elements in the DOM tree.
    • Note: The remove() method is faster than empty() or detach() method.

        

  12. Is jQuery a JavaScript or JSON library file ?
    jQuery is a library of JavaScript file and it consists of DOM event effects and also the Ajax functions. jQuery is alleged to be one JavaScript file.
  13.     

  14. What are the various ajax functions available in Jquery ?
    Ajax allows the user to exchange data with a server and update parts of a page without reloading the entire page. Some of the functions of ajax are as follows:

  15.     

  16. Mention the compatible operating systems with jQuery.
    • Mac
    • Windows
    • Linux
  17.     

  18. How to include the jQuery library in the ASP.Net project ?
    • Download the jQuery library from jQuery.com
    • include that reference in the asp.net page.
  19.     

  20. Explain bind() vs live() vs delegate() methods in jQuery.
    The bind() method does not attach the events to those elements that are added once DOM is loaded whereas live() and delegate() methods attach events to the future elements also.

    The difference between live() and delegate() methods is that the live() function does not work in chaining. It will work only on a selector or an element while delegate() method will work in chaining.

  21.     

  22. Write the command that gives the version of jQuery ?
    The command $.ui.version returns jQuery UI version.
  23.     

  24. What is jQuery connect ?
    A jQuery connect is a plugin that is used to connect or bind a function with another function. Connect is used to execute the function from the other function or plugin is executed.
  25.     

  26. How to use connect ?
    • Download jQuery connect file from jQuery.com
    • Include that file in the HTML file.
    • Use $.connect function to connect a function to another function.
  27.     

  28. What is the use of param() method in JQuery ?
    The param() method in jQuery is used to create a serialized representation of an object.
  29.     

  30. Difference between $(this) and this in jQuery ?
    The this and $(this) references are same but the difference is “this” is used in the traditional way but when “this” is used with $() then it becomes a jQuery object.
  31.     

  32. Difference between find and children methods ?
    The find() method is used to find all the descendant elements of the selected element and the children() method is used to find all the children element related to that selected element.
  33.     

  34. In what scenarios jQuery can be used ?
    jQuery can be used in following scenarios:

    • Mainly for Animation effects
    • Manipulation purpose
    • Calling functions on events
    • Apply CSS static or dynamic
  35.     

  36. How to read, write and delete cookies in jQuery ?
    We can deal with cookies in jquery using Dough cookie plugin. Dough is easy to use and has powerful features.

    • Create cookie:
      $.dough(“cookie_name”, “cookie_value”);
    • Read Cookie:
      $.dough(“cookie_name”);
    • Delete cookie:
      $.dough(“cookie_name”, “remove”);
  37.     

  38. Features of jQuery which are used in web applications ?
    jQuery uses features like Sliding, File uploading and accordian in web applications.

jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, It is widely famous with it’s philosophy of “Write less, do more”.
You can learn jQuery from the ground up by following this jQuery Tutorial and jQuery Examples.


My Personal Notes arrow_drop_up
Last Updated : 03 Aug, 2021
Like Article
Save Article
Similar Reads
Related Tutorials