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

41⟩ Explain 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(){

});

 148 views

42⟩ Explain width() vs css('width')?

1. In jQuery, there are two way to change the width of an element.

2. One way is using .css('width') and other way is using .width().

For example

$('#mydiv').css('width','300px');

$('#mydiv').width(100);

1. The difference in .css('width') and .width() is the data type of value we specify or return from the both functions.

2. In .css('width') we have to add "px" in the width value while in .width() we don't have to add.

3. When you want to get the width of "mydiv" element then .css('width') will return '300px' while .width() will return only integer value 300.

 183 views

44⟩ Explain bind() vs live() vs delegate() methods?

► The bind() method will not attach events to those elements which are added after DOM is loaded while live() and delegate() methods attach events to the future elements also.

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

For example

$(document).ready(function()

{

$("#myTable").find("tr").live("click",function()

{

alert($(this).text());

});

});

Above code will not work using live() method. But using delegate() method we can accomplish this.

$(document).ready(function()

{

$("#dvContainer")children("table").delegate("tr","click",function()

{

alert($(this).text());

});

});

 136 views

45⟩ How to set the value of an element using jQuery?

The val(val) method sets the value attribute of every matched element if it is called on <input> but if it is called on <select> with the passed <option> value then passed option would be selected, if it is called on check box or radio box then all the matching check box and radiobox would be checked.

 157 views

48⟩ What are all the ways to include jQuery in a page?

Following are the ways to include jQuery in a page:

► Local copy inside script tag

► Remote copy of jQuery.com

► Remote copy of Ajax API

► Local copy of script manager control

► Embedded script using client script object

 155 views