JQuery Basic Interview Questions Part-1



What is jQuery?

  • jQuery is a JavaScript library that simplifies JavaScript and AJAX programming. JavaScript is used to add interactivity and dynamic content to web pages. AJAX (Asynchronous JavaScript and XML) is used for handling external data asynchronously through JavaScript, without refreshing the whole page.
  • jQuery emphasizes the interaction between JavaScript and HTML. jQuery contains all the common DOM, event, effects, and Ajax functions in a single JavaScript file.
  • The jQuery file needs to be included in the file which is going to use the jQuery functionality.
  • jQuery provides a new class called jQuery without extending the built-in JavScript classes which acts as a wrapper around objects for providing them the extended operations.
Advantages of jQuery
The advantages of using jQuery are:
  • JavaScript enhancement without the overhead of learning new syntax
  • Ability to keep the code simple, clear, readable and reusable
  • Eradication of the requirement of writing repetitious and complex loops and DOM scripting library calls
Explain the features of jQuery.
  • Features of jQuery are :
  • Effects and animations
  • Ajax
  • Extensibility
  • DOM element selections functions
  • Events
  • CSS manipulation
  • Utilities - such as browser version and the each function.
  • JavaScript Plugins
  • DOM traversal and modification.

Explain the concepts of "$ function" in jQuery with an example.

The type of a function is "function".
There are a lot of anonymous functions is jquery.

$(document).ready(function() {});
$("a").click(function() {});

$.ajax({
url: "someurl.php",
success: function() {}
});

Why is jQuery better than javascript?
  • jQuery is great library for developing ajax based application.
  • It helps the programmers to keep code simple and concise and reusable.
  • jQuery library simplifies the process of traversal of HTML DOM tree.
  • jQuery can also handle events, perform animation, and add the ajax support in web applications.

Explain how jQuery Works.

<html>
< head>
< script type="text/javascript" src="jquery.js"></script>
< script type="text/javascript">
// You can write the code here
< /script>
< /head>
< body>
< a href="http://careerride.com/">CareerRide</a>
< /body>
< /html>

When can you use jQuery?

jQuery can be used to for developing ajax based applications
It can be used to keep the code simple, concise and reusable.
It simplifies the process of traversal of HTML DOM tree.
It can also handle events, perform animation, and add the ajax support in web applications.

What does dollar sign($) means in Jquery?
Dollar sign is nothing but it's an alias for Jquery. Take a look at below jquery code
$(document).ready(function(){
});
Over here $ sign can be replaced with "jQuery" keyword.
jQuery(document).ready(function(){
});

No comments:

Post a Comment