JQuery Programmer

  Home  Client Side Scripting  JQuery Programmer


“JQuery Programmer Frequently Asked Questions in various JQuery Developer job Interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting”



154 JQuery Programmer Questions And Answers

141⟩ What is the difference between eq() and get() methods in jQuery?

eq() returns the element as a jQuery object. This method constructs a new jQuery object from one element within that set and returns it. That means that you can use jQuery functions on it.

get() return a DOM element. The method retrieve the DOM elements matched by the jQuery object. But as it is a DOM element and it is not a jQuery-wrapped object. So jQuery functions can't be used.

 182 views

145⟩ Why is the block display style used for animations?

In html only the block level elements can have custom heights and widths. So when a user defines an animation method for usage such as show, hide, slide up etc the display css property of the block being animated is set to display block style. On completion of the animation the display style of the block would be changed to its original value. This procedure does not work properly for inline elements and the following workarounds can be applied to it:

- If the user wants the element to remain inline and only want to animate it in and out he can use the fadein and fadeout animation instead of using the show method.

- The user can also use a block level element with float to make the element appear inline with the rest of the content around it.

 158 views

147⟩ What is the difference between .js and .min.js?

jQuery library comes in 2 different versions Development and Production/Deployment. The deployment version is also known as minified version. So .min.js is basically the minified version of jQuery library file. Both the files are same as far as functionality is concerned. but .min.js is quite small in size so it loads quickly and saves bandwidth

 167 views

148⟩ Create a plugin that would add and remove a class on hover?

The plugin can be considered to be simply a new method that can be used by a user to extend the prototype object of a jquery. A plugin performs some actions on a collection of elements. Each method that comes with the jquery core can be considered to be a plugin.

The code for creating a plugin that would add and remove a class on hover would be as follows:

(function($)

{

$.fn.hoverClass = function(c)

{

return this.hover(

function() { $(this).toggleClass(c); }

);

};

})(jQuery);

// using the plugin

$('li').hoverClass('hover');

 161 views

152⟩ What is jQuery plugin and what is the advantage of using plugin?

A plug-in is piece of code written in a standard JavaScript file. These files provide useful jQuery methods which can be used along with jQuery library methods. jQuery plugins are quite useful as its piece of code which is already written by someone and re-usable, which saves your development time.

 146 views