JQuery Interview Questions and Answers

    1 Votes

Top 75+ JQuery Interview Questions and Answers on basic and advanced topics for freshers and experienced Java, Dot Net and PHP Web Developers.

1) What is Jquery?

Jquery is javascript library and it is used for HTML DOM access (manipulating and traversing of HTML DOM elements). It provides most powerful feature of event handling as well.
2) Explain we can use Jquery?
Jquery can be used along with other libraries. It works with simple and complex javascript and AJAX.
3) How we can use Jquery in ASP.NET?

We can use Jquery by downloading the jquery and use it in our project or can use CDNs available from Google, Microsoft and give the CDN URL in ASPX page.

4) Explain difference between Jquery and Javascript?
Jquery is a library and Javascript is a language and Jquery provides full-fledged support for javascript language.
5) What is the significance of ‘$’ sign in Jquery?
‘$’ is used as an alias for jquery. Below are the examples of how we can use it –
Eg: $(‘#MyControl’)
6) What are the differences between “body.onload” and “document.ready” methods?
  • “body.onload” method will be used only once in a page where as “document.ready” method can be used multiple times in a same page. “body.onload” method will be called once all the resources of the page are loaded. (images, css and DOM).
  • But “document.ready” method called once DOM is ready and it does not wait till other resources are loaded.

 

7) Why we can use Jquery in our application?

Below are the main reasons where we can use Jquery –

  • To apply the css for the controls.
  • To give special effects for the controls.
  • Event Handling.
  • To provide the AJAX support.

8) How we can hide and show the controls in Jquery?

Access the control using ‘$’ and use the methods “Hide()” and “Show()” like below. For example –

$(‘#MyControl’).Hide()
$(‘#MyControl’).Show()

9) How to show the alert message on button click in Jquery?

Jquery is one of the most powerful libraries what we have and it provides event handling. This scenario can be handled by “OnClick” of the button. Below is the code snippet –

<input type=”button” id=”myButton” onclick=”alert(‘Hi’)” />

10) What is the meaning of Selectors in Jquery?

In javascript we have several methods to find the controls like – “getElementByName” and “getElementByID”, which is used to find the control based on Name of the control and ID of the control respectively. Similarly in Jquery we have find the controls using selectors. Below are some of the selectors -

  • “*” - To Find all the elements of the page.
  • “#” – Used to find the control by ID.
  • “.” - Used to find the control by Class.

11) In ASP.NET, Jquery will be added in Content and Master pages both?

No. If the Jquery file added in master page then content pages will going to use that.

12) What is the advantage of using minified version of Jquery?

Advantage of using minified verison of Jquery will mainly be performance. Size of the minified jquery file will be around 76KB where as the normal Jquery file size will be around 180KB.

13) Can you give an example of selecting an element based on its class name ?

Below is the sample code snippet –

$(‘.MyControl’).Hide()

14) What are the difference between “Length” and “Size” in Jquery?

Both are used to find number of elements in an object. “Length” will be used commonly because it’s faster compared to “size” because “length” is a property and “size” is a method.

15) How can we set the page title in Jquery?

Below is the code snippet used to set the page title -

$(function(){
$(document).attr(“title”, “A4 Academics”);
});

16) What is the use of Jquery Connect?

Connect method is used to bind one function to another and it’s used to execute the function when a function is executed from another object.

17) How to use AJAX in Jquery?

Jquery supports AJAX calls, below is the code snippet of AJAX in Jquery –

$.ajax({
url: ‘MyURL',
success: function(response) {
//My Code goes here
},
error: function(err) {
//My Code goes here }
});
Page 1 of 4
Planning to do an MBA?
A quick all-in-one MBA entry manual for MBA Aspirants. Book covers
  • Possible MBA Tests & Exam Preparation
  • Tips to choose right MBA Program
  • Essay, Resume & Letter of Recommendation
  • MBA Interview Preparation
  • MBA Financial Planning
Price - 6.99$
 

Popular Videos

How to speak to people

How to speak so that people want to listen.

Got a tip or Question?
Let us know

Related Articles

HTML/HTML5 Interview Questions and Answers
Javascript Interview Questions and Answers
Top AngularJS Questions and Answers
Top 60+ Node.JS Interview Questions and answers
Top 70 CSS Interview Questions and Answers