Which option is correct to use the below function to set cursor position for textarea? Function: $.fn.selectRange = function(start, end) { return this.each(function() { if (this.setS...
$('#elem').selectRange(3,5); 96.0%
$('#elem').selectRange(3 5); 1.0%
$('#elem').selectRange(X:3,Y:5); 1.0%
$('#elem').fn.selectRange(3,5); 0.0%
$('#a1').one('click', {times: 3}, function1); Which of the following is true for the above?
function1 will be executed once regardless of the number of times a1 is clicked. 86.0%
function1 will be executed at most 3 times if a1 is clicked more than twice. 10.0%
There is at most one instance of function1 to be executed at a time. 0.0%
There are at most three instances of function1 to be executed at a time. 2.0%
$('#id1').animate({width:"80%"}, "slow") The above code snippet will ___.
animate the tag with id1 from the current width to 80% width. 97.0%
animate the tag with id1 from 80% width to current width. 0.0%
animate the tag with id1 from the current 80% width to 0px. 0.0%
animate the tag with id1 from 80% width to 100% width. 2.0%
$("div").find("p").andSelf().addClass("border"); The statement adds class border to ___.
all div tags and p tags in div tags 97.0%
all div tags 0.0%
all p tags 0.0%
all p tags enclosed in div tags 2.0%
$("div").find("p").andSelf().addClass("border"); The statement adds class border to ___.
all div tags and p tags in div tags 97.0%
all div tags 0.0%
all p tags 0.0%
all p tags enclosed in div tags 2.0%
Assume that you want that first the tag with "id1" fades out and then the tag with "id2" fades in. Which of the following code snippets allow(s) you to do so?
$('#id1').fadeOut('fast'); $('#id2').fadeIn('slow'); 2.0%
$('#id2').fadeIn('slow'); $('#id1').fadeOut('fast'); 0.0%
$('#id1').fadeOut('fast', function() {$('#id2').fadeIn('slow')}); 97.0%
$('#id2').fadeIn('slow', function() {$('#id1').fadeOut('fast')}); 0.0%
Assuming that the jQuery UI library is used to make a list sortable, which of the following code snippets makes "list1" sortable?
$('#list1').sortable(); 100.0%
$('#list1').changeable(); 0.0%
$('#list1').interchangeable(); 0.0%
$('#list1').organizeable(); 0.0%
Consider the following code snippet: <font size=2> <ul id='id1'> <li id='li1'>Items 1</li> <li id='li2'>Items 2</li> <li id='li3'>Items 3</li> </ul> </font> Which of the following c...
$('#id1 li').not($('#li2')); 100.0%
$('#id1 li').except($('#li2')); 0.0%
$('#id1 li').remove($('#li2')); 0.0%
$('#id1 li').delete($('#li2')); 0.0%
Consider the following code snippet: <ul id='id1'> <li id='li1'>Items 1</li> <li id='li2'>Items 2</li> <li id='li3'>Items 3</li> </ul> Which of the following code snippets returns the...
$('#li2').siblings(); 95.0%
$('#id2').siblings('#li2'); 4.0%
$('#li2').children(); 0.0%
$('#id2').children('#li2'); 0.0%
Consider the following code snippet: $('#button1').bind('click', function(data) {...}); What is the data argument?
Click event's data 52.0%
Function's data 47.0%
Global variable 0.0%
Local variable 0.0%
Consider the following code snippet: $('#ul1 li').live('click', function1); $('#ul1').after('<li id="lastLi">Last item</li>'); Is function1 executed if "lastLi" is clicked?
Yes 0.0%
No 87.0%
"lastLi" does not exist. 12.0%
Consider the following code snippet: $('#id1').animate({width:"240px"}, { queue:false, duration:1000 }).animate({height:"320px"}, "fast"); The order of the animations of this code snippet is ___.
First the width animation, then the height animation. 5.0%
First the height animation, then the width animation. 7.0%
Both the width animation and the height animation occur at the same time. 86.0%
The order of animations is random. 0.0%
Consider the following code snippet: $('#table1').find('tr').filter(function(index) { return index % 3 == 0}).addClass('firstRowClass'); The result of the above code snippet is ___.
The rows of table1 at order 3n + 1 (n = 0, 1, 2,...) will belong to the class firstRowClass. 91.0%
The rows of table1 at order 3n (n = 1, 2,...) will belong to the class firstRowClass. 5.0%
All rows of table1 will belong to the class firstRowClass. 0.0%
No row of table1 will belong to the class firstRowClass. 2.0%
Consider the following code snippet: $(document).ready(function() { $('div').each(function(index) { alert(this); }); }); Which of the following objects does the 'this' variable refer to?
window 0.0%
document 0.0%
The current div tag of the iteration. 100.0%
The last element tag in the body. 0.0%
Consider the following code snippet: <font size=2> <ul id='id1'> <li id='li1'>Items 1</li> <li id='li2'>Items 2</li> <li id='li3'>Items 3</li> </ul> </font> Which of the following code snippe...
$('#id1 li').not($('#li2')); 100.0%
$('#id1 li').except($('#li2')); 0.0%
$('#id1 li').remove($('#li2')); 0.0%
$('#id1 li').delete($('#li2')); 0.0%
Consider the following code snippet: <ul id='id1'> <li id='li1'>Items 1</li> <li id='li2'>Items 2</li> <li id='li3'>Items 3</li> </ul> Which of the following code snippets return(s) a set of ...
$('#id1 li').not($('#li2')); 96.0%
$('#id1 li').except($('#li2')); 3.0%
$('#id1 li').remove($('#li2')); 0.0%
$('#id1 li').delete($('#li2')); 0.0%
Consider the following code snippet: <ul id='id1'> <li id='li1'>Items 1</li> <li id='li2'>Items 2</li> <li id='li3'>Items 3</li> </ul> Which of the following code snippets returns the same re...
$('#li2').siblings(); 100.0%
$('#id2').siblings('#li2'); 0.0%
$('#li2').children(); 0.0%
$('#id2').children('#li2'); 0.0%
Consider the following code snippet: $('#button1').bind('click', function(data) {...}); What is the data argument?
Click event's data 83.0%
Function's data 16.0%
Global variable 0.0%
Local variable 0.0%
Consider the following code snippet: $('#id1').animate({width:"240px"}, { queue:false, duration:1000 }).animate({height:"320px"}, "fast"); The order of the animations of this code snippet is ___.
First the width animation, then the height animation. 3.0%
First the height animation, then the width animation. 10.0%
Both the width animation and the height animation occur at the same time. 86.0%
The order of animations is random. 0.0%
Consider the following code snippet: $('a.arrow-1').click(function () { $('.second-row').slideUp(); $(this).parent('.first-row').siblings('.second-row').slideDown(); }); The order of the a...
The targeted parent sibling .second-row will slide up, then .second-row will slide down. 0.0%
.second-row will slide up, then the targeted parent sibling .second-row will slide down. 84.0%
Both the targeted parent sibling .second-row will slide down and the .second-row will slide up actions will occur at the same time. 12.0%
None of the above. 3.0%
Consider the following code snippet: $('span.item').each(function (index) { $(this).wrap('<li>Item</li>'); }); What does this code snippet do?
Wraps each span tag that has class item within a li tag. 100.0%
Inserts each span tag that has class item into a li tag. 0.0%
Inserts <li>Item</li> into each span that has item class. 0.0%
Replaces each span tag that has class item with a <li>Item</li>. 0.0%
Consider the following code snippet: $(document).ready(function1); $(document).ready(function2); $(document).ready(function3); Which of the following functions are executed when DOM is ready?
function1 0.0%
function2 0.0%
function3 0.0%
function1, function2, and function3 91.0%
No function is executed. 8.0%
each() is a generic ___ function.
comparator 0.0%
operator 0.0%
iterator 100.0%
normal 0.0%
How can an Ajax request that has not yet received a response be canceled or aborted?
//xhr is an Ajax variable xhr.abort() 93.0%
//xhr is an Ajax variable xhr.cancel() 3.0%
//xhr is an Ajax variable xhr.die() 0.0%
//xhr is an Ajax variable xhr.destroy() 3.0%
How can the child img be selected inside the div with a selector?
jQuery(this).children("img"); 6.0%
jQuery(this).find("img"); 93.0%
$(this).find("img").attr("alt") 0.0%
$(this).children("img").attr("alt") 0.0%
How can the href for a hyperlink be changed using jQuery?
$("a").link("http://www.google.com/"); 0.0%
$("a").change("href","http://www.google.com/"); 0.0%
$("a").link("href","http://www.google.com/"); 0.0%
$("a").attr("href", "http://www.google.com/"); 100.0%
If jQuery is included before another library, how can conflict between jQuery and that library be avoided?
By calling jQuery.noConflict(); right after including jQuery. 93.0%
By calling jQuery.useDefault = false; right after including jQuery. 0.0%
By calling jQuery.useShortcut = false; right after including jQuery. 0.0%
By using the jQuery object when working with the jQuery library and using the $ object for other libraries. 6.0%
jQuery allows simulating an event to execute an event handler as if that event has just occurred by using ___.
trigger function 97.0%
execute function 0.0%
intimate function 0.0%
jQuery does not have this feature. 2.0%
jQuery allows you to use ___ function to switch between showing and hiding an element.
show 0.0%
hide 0.0%
switch 0.0%
toggle 100.0%
offset function gets the current offset of the first matched element in pixels relative to the ___.
document 96.0%
parent element 0.0%
children element 0.0%
container 3.0%
One advantage of $.ajax function over $.get or $.post is that ___.
$.ajax offers error callback option. 94.0%
$.ajax is easier to use. 0.0%
$.ajax allows passing request parameters. 5.0%
the result of $.ajax is formatted. 0.0%
The height function returns the height of an element in ___.
pixel units 100.0%
point units 0.0%
em units 0.0%
millimeter units 0.0%
The hide() function hides an element by ___.
setting "display" inline style attribute of that element to "none". 100.0%
setting "visibility" inline style attribute of that element to "hidden". 0.0%
setting the horizontal attribute of that element to "-100". 0.0%
setting the vertical attribute of that element to "-100". 0.0%
The position function gets the ___ positions of an element that are relative to its offset parent.
top and left 100.0%
top and right 0.0%
bottom and left 0.0%
bottom and right 0.0%
Using an element of some kind that is being hidden using .hide() and shown via .show(). Which of the following is the best way to determine if that element is currently hidden or visible on the sc...
$(element).is(":visible") 100.0%
$(this).css("visibility") == "hidden" 0.0%
$(element).is(":invisible") 0.0%
$(this).css("visibile") == "hidden" 0.0%
What does $('tr.rowClass:eq(1)'); return?
One element set which is the second row of the first table. 94.0%
One element set which is the first row of the first table. 5.0%
A set of tr tags which have "rowClass:eq(1)" class . 0.0%
A set of tr tags which have "eq(1)" class . 0.0%
What is the purpose of $(document).ready() function in Jquery?
To execute functions after all content and images are loaded 0.0%
To execute functions after DOM is loaded 100.0%
To execute functions before DOM load 0.0%
To execute functions before content and images load 0.0%
What is the result of NaN == NaN?
true 0.0%
false 100.0%
An error occurs. 0.0%
None of these. 0.0%
What is the result of this function: jQuery.makeArray ( true )?
1 0.0%
NaN 0.0%
[ true ] 100.0%
[] 0.0%
Which of the following code snippets insert(s) the code snippet <div class="footer">footer</div> at the end of div tags?
$('div').append('<div class="footer">footer</div>'); 51.0%
$('div').appendTo('<div class="footer">footer</div>'); 0.0%
$('<div class="footer">footer</div>').append('div'); 0.0%
$('<div class="footer">footer</div>').appendTo('div'); 48.0%
Which of the following code snippets insert(s) the code snippet <font size=2><div class="footer">footer</div></font> at the end of div tags?
$('div').append('<div class="footer">footer</div>'); 57.0%
$('div').appendTo('<div class="footer">footer</div>'); 0.0%
$('<div class="footer">footer</div>').append('div'); 0.0%
$('<div class="footer">footer</div>').appendTo('div'); 42.0%
Which of the following events can be used to disable right click contextual menu?
contextmenu 96.0%
contextualmenu 0.0%
rightclickmenu 0.0%
The right-click contextual menu cannot be disabled. 3.0%
Which of the following functions can be used to stop event propagation?
stopPropagation 87.0%
disablePropagation 0.0%
cancelPropagation 9.0%
preventPropagation 3.0%
Which of the following functions is/are built-in jQuery regular expression function(s)?
test 0.0%
match 70.0%
find 5.0%
jQuery does not have built-in regular expression functions. 23.0%
Which of the following gets the href attribute of "id1"?
$('#id1).attr('href'); 100.0%
$('#id1').getAttribute('href'); 0.0%
$('#id1)[0].attr('href'); 0.0%
All of these. 0.0%
Which of the following is the correct use of ajaxStart() function?
ajaxStart() function is used to start ajax call. 7.0%
ajaxStart() function is used to run some code when ajax call start. 79.0%
a & b 2.0%
None of the above. 10.0%
Which of the following is the correct way to add an additional option and select it with jQuery?
$('#mySelect').append('<option value="whatever">text</option>').val('whatever') 100.0%
$('#mySelect').html('<option value="whatever">text</option>').val('whatever') 0.0%
$('#mySelect').text('<option value="whatever">text</option>').val('whatever') 0.0%
$('#mySelect').val('whatever') 0.0%
Which of the following is the correct way to change the image source during click event of a button in jQuery?
$("#button").click(function(){ $(“img”).src(); }); 3.0%
$("#button").click(function(){$(“img”).attr(); }); 96.0%
$("#button").submit(function(){$(“img”).text();}); 0.0%
$("#button").submit(function(){$(“img”).html(); }); 0.0%
Which of the following is the correct way to debug JavaScript/jQuery event bindings with Firebug or a similar tool?
var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, value) { console.log(value) // prints "function() { console.log('clicked!') }" }) 96.0%
$.fn.listHandlers = function(events, outputFunction) { return this.each(function(i){ var elem = this, dEvents = $(this).data('events'); if (!dEvents) {return;} $.each(dEvents, function(name, handler){ if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, '
' + i + ': [' + name + '] : ' + handler ); }); } }); }); }; 3.0%
var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, value) { event.console.log(value); }) 0.0%
$.fn.listHandlers = function(events, outputFunction) { return this.each(function(i){ var elem = this, dEvents = $(this).data('events'); $.each(dEvents, function(name, handler){ if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, '
' + i + ': [' + name + '] : ' + handler ); }); } }); }); }; 0.0%
Which of the following is the correct way to disable an input field with jQuery?
$("input").attr('disabled','disabled'); 100.0%
$("input").css('disabled','disabled'); 0.0%
$("input").attr('disable','disable'); 0.0%
$("input").('disabled'); 0.0%
Which of the following is the correct way to get "Option B" with the value '2' from following HTML code in jQuery? <select id='list'> <option value='1'>Option A</option> <option value='2'>O...
$("#list[value='2']").text(); 0.0%
$("#list option[value='2']").text(); 100.0%
$(this).find("option:selected").text(); 0.0%
element.options[element.selectedIndex].text 0.0%
Which of the following is the correct way to get the value of a textbox using id in jQuery?
$(“.textbox”).text() 0.0%
$(“#textbox”).val() 100.0%
$(“.textbox”).val() 0.0%
$(“#textbox”).text() 0.0%
Which of the following is the correct way to manage a redirect request after a jQuery Ajax call?
$.ajax({ type: "POST", url: reqUrl, data: reqBody, dataType: "json", success: function(data, textStatus) { if (data.redirect) { // data.redirect contains the string URL to redirect to window.location.href = data.redirect; } else { // data.form contains the HTML for the replacement form $("#myform").replaceWith(data.form); } } }); 96.0%
public ActionResult Index(){ if (!HttpContext.User.Identity.IsAuthenticated) { HttpContext.Response.AddHeader("REQUIRES_AUTH","1"); } return View() } 0.0%
$.ajax( error: function (jqXHR, timeout, message) { var contentType = jqXHR.getResponseHeader("Content-Type"); if (jqXHR.status === 200 && contentType.toLowerCase().indexOf("text/html") >= 0) { window.location.reload(); } }); 4.0%
$(document).ready(function () { $(document).ajaxSend( function(event,request,settings) { var intercepted_success = settings.success; settings.success = function( a, b, c ) { if( request.responseText.indexOf( "<html>" ) > -1 ) window.location = window.location; else intercepted_success( a, b, c ); }; }); }); 0.0%
Which of the following is the correct way to select an option based on its text in jQuery?
$("#myselect option").filter(function(){ return $(this).text() == 'text';}).prop('selected', true); 100.0%
$("#myselect option").prop('selected', true).text("text") 0.0%
$("#myselect").filter("option").prop('selected', true).text("text"); 0.0%
$("#myselect").filter(function(){ return $(this).val() == 'text';}).prop('selected', true); 0.0%
Which of the following methods can be used to copy element?
clone 96.0%
cloneTo 3.0%
move 0.0%
moveTo 0.0%
Which of the following methods can be used to utilize the animate function with the backgroundColor style property?
Use the jQuery UI library. 95.0%
There is no need to do anything as jQuery core already supports that style property. 4.0%
There is no way to use animate with that style property. 0.0%
Which of the following represents the best way to make a custom right-click menu using jQuery?
$(document).bind("contextmenu", function(event) { event.preventDefault(); $("<div class='custom-menu'>Custom menu</div>") .appendTo("body") .css({top: event.pageY + "px", left: event.pageX + "px"}); }); 90.0%
$(document).bind("contextrightmenu", function(event) { event.preventDefault(); $("<div class='custom-menu'>Custom menu</div>") .appendTo("body") .css({top: event.pageY + "px", left: event.pageX + "px"}); }); 9.0%
$(document).bind("rightclick", function(event) { event.preventDefault(); $("<div class='custom-menu'>Custom menu</div>") .appendTo("body") .css({top: event.pageY + "px", left: event.pageX + "px"}); }); 0.0%
None of the above. 0.0%
Which of the following returns the children tags of "id1"?
$('#id1').children(); 100.0%
$('#id1').getChildren(); 0.0%
children('#id1'); 0.0%
getChildren('#id1'); 0.0%
Which of the following values is/are valid value(s) of secondArgument in addClass('turnRed', secondArgument); function, if the jQuery UI library is being used?
'fast' 48.0%
slow 0.0%
1000ms 0.0%
3000 51.0%
Which of the following will get the first column of all tables using jQuery?
$('table.tblItemTemplate first-child'); 0.0%
$('table.tblItemTemplate tr:first-child'); 0.0%
$('table.tblItemTemplate td:first-child'); 100.0%
$('tabletblItemTemplate td:first-child'); 0.0%
Which of the following will show an alert containing the content(s) of a database selection?
$.ajax({ type: "GET", url: "process_file.php?comp_id="+comp_id, success: function (result) { alert(result); } }); 100.0%
$.ajax({ type: "GET", success: function (result) { alert(result); } }); 0.0%
$.ajax({ type: "GET", url: "process_file.php?comp_id="+comp_id, error: function (result) { alert(result); } }); 0.0%
$.ajax({ type: "GET", url: "process_file.php?comp_id="+comp_id, Complete: function (result) { alert(result); } }); 0.0%
Which option can be used to have jQuery wait for all images to load before executing something on a page?
All jQuery code need to add inside $function() { } syntax 0.0%
With jQuery, can use $(document).ready() to execute something when the DOM is loaded and$(window).load() to execute something when all other things are loaded as well, such as the images. 100.0%
With jQuery, can use $(document).ready() or $(window).load() syntax as these both are the same. 0.0%
$(window).onLoad(function() { }) 0.0%
Which option is correct to perform a synchronous AJAX request?
beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: 'http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); } }); } 3.0%
beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: 'http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); }, async: sync(true) }); } 0.0%
beforecreate: function(node,targetNode,type,to) { jQuery.ajax({ url: 'http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value), success: function(result) { if(result.isOk == false) alert(result.message); }, async: false }); } 96.0%
jQuery only allow asynchronous AJAX request. 0.0%
Consider the following code snippet:
<ul id='id1'>
<li id='li1'>Items 1</li>
<li id='li2'>Items 2</li>
<li id='li3'>Items 3</li>
</ul>
Which of the following code snippets return(s) a set of all li tags within id1 except for the li tag with id li2?
$('#id1 li').not($('#li2'));
$('#id1 li').except($('#li2'));
$('#id1 li').remove($('#li2'));
$('#id1 li').delete($('#li2'));
Whats the right way to access the contents of an iframe using jQuery?
If the <iframe> is from the same domain, the elements are easily accessible as
$("#iFrame").contents().find("#someDiv").removeClass("hidden");
$('#frametest').HTML()
$('some selector', frames['nameOfMyIframe'].document).innerHTML()
All of Above
Consider the following code snippet:
<ul id='id1'>
<li id='li1'>Items 1</li>
<li id='li2'>Items 2</li>
<li id='li3'>Items 3</li>
</ul>
Which of the following code snippets returns the same result as $('#id1 li').not($('#li2'));?
$('#li2').siblings();
$('#id2').siblings('#li2');
$('#li2').children();
$('#id2').children('#li2');
Which of the following will select a particular option in a <select> element using its index?
$('select option[value="1"]')
$('select option:eq(1)')
$('select option:contains("Selection 1")')
All of the above.
Consider the following code snippet:
$('#ul1 li').live('click', function1);
$('#ul1').after('<li id="lastLi">Last item</li>');
Is function1 executed if lastLi is clicked?
Yes
No
"lastLi" does not exist.
Which of the following functions will return an empty set when end() function is chained right after that function?
add
children
filter
remove
Consider the following code snippet:
var message = 'Message';
$('#id1').bind('click', function() {
alert(message);
});
message = 'New message';
$('#id2').bind('click', function() {
alert(message);
});
What does the alert box display if "id1" is clicked?
Message
New message
Nothing
None of these
How or where can a plugin be declared, so that the plugin methods are available for the script?
In the head of the document, include the plugin after main jQuery source file, before the script file.
In the head of the document, include the plugin after all other script tags.
In the head of the document, include the plugin before all other script tags.
Anywhere in the document.
Which of the following makes use of jQuery to select multiple elements?
$('table td').eq([0, 5, 9])
$('table td:eq(0), table td:eq(5), table td:eq(9)')
$('table td').eqAny([1, 5, 9]);
None of these.
Which of the following is correct with regards to how to upload a file asynchronously with jQuery?
In HTML5 file can be uploaded using Ajax and jQuery. Not only that, file validations(name,size,MIME-type) and handling the progress event can also be done with the HTML5 progress tag(or a div).
$('#one-specific-file').ajaxfileupload({
'action': '/upload.php'
});
Ajax file uploads cannot be done.
$(document).ready(function() {
$("#uploadbutton").jsupload({
action: "addFile.do",
onComplete: function(response){
alert( "server response: " + response);
}
});
Consider having multiple $(document).ready() functions in one or many linked JavaScript files.
Given this information, which of the following will be executed?
first ready() function
last ready() function
All ready() functions
None of them
Which of the following methods can be used to load data?
getJSON
get
ajaxSend
ajaxStart
Which of the following values is/are valid argument(s) of the eq() function?
1
'2'
Both 1 and '2'.
Neither 1 nor '2'.
$.merge(array1, array2);
The above function merges ___.
array1 into array2.
array2 into array1.
array1 with array2 and returns the result.
The statement is invalid. The correct one is array1.merge(array2);
Using an element of some kind that is being hidden using .hide() and shown via .show(). Which of the following is the best way to determine if that element is currently hidden or visible on the screen?
$(element).is(":visible")
$(this).css("visibility") == "hidden"
$(element).is(":invisible")
$(this).css("visibile") == "hidden"
Consider the following code snippet:
$('#id1').animate({width:"240px"}, "slow").animate({height:"320px"}, "fast");
The order of the animations of this code snippet is:
First the width animation, then the height animation.
First the height animation, then the width animation.
Both the width animation and the height animation occur at the same time.
The order of animations is random.
Which of the following is the correct way to assign a selected value of a drop-down list using jQuery?
$("#myDDL").val(2);
$(".myDDL").children("option").val(2);
$(".myDDL").val('2');
$(".myDDL").children("option").innerText(â2â);
Which of the following is the correct way to distinguish left and right mouse click event in jQuery?
event.what
event.which
event.click
event.whichclick
Which of the following is the best way to open a jQuery UI dialog box without a title bar?
$("#ui-dialog-titlebar").hide();
$(".ui-dialog-titlebar").hide();
$("#dialog").siblings('div#ui-dialog-titlebar').remove();
$(".ui-titlebar").hide();
Which of the following is the correct way to select <a> on the basis of href using jQuery?
jQuery("a").href()
jQuery("a").attr("href")
jQuery("a[href='url']")
jQuery("a attr[href='url']")
Which of the following is the correct way to do the following JavaScript Code with jQuery?
var d = document;
var odv = d.createElement("div");
odv.style.display = "none";
this.OuterDiv = odv;
var t = d.createElement("table");
t.cellSpacing = 0;
t.className = "text";
odv.appendChild(t);
this.$OuterDiv = $('<div></div>')
.hide()
.append($('<table></table>')
.attr({ cellSpacing : 0 })
.addClass("text")
);
var t = $("<table cellspacing='0' class='text'></table>");
$.append(t);
$('<div/>',{
text: 'Div text',
'class': 'className'
}).appendTo('#parentDiv');
var userInput = window.prompt("please enter selector");
$(userInput).hide();
Consider the following code snippet:
<div id='id1'>
<div id='id2'>Div 2</div>
</div>
Which of the following tags is/are in the result of $('#id2').parents();?
html
head
body
html and body
head and body
Which of the following is the correct way to check which key was pressed?
$('#txtValue').keypress(function(event){ $('#txtvalue').
alert( (event.keyCode) );
});
$('#txtValue').keypress(function(event){
alert( String.fromCharCode( (event.keyCode) ) );
});
$('#txtValue').keypress(function(event){
alert( fromCharCode( (event.keyCode) ) );
});
$('#txtValue').keypress(function(event){
alert( String.fromCharCode( (event) ) );
});
$.grep(array1, function1);
The above statement ___ the elements of array1 array which satisfy function1 function.
sorts
updates
removes
finds
Which of the following is the correct way to get "Option B" with the value '2' from following HTML code in jQuery?
<select id='list'>
<option value='1'>Option A</option>
<option value='2'>Option B</option>
<option value='3'>Option C</option>
</select>
$("#list[value='2']").text();
$("#list option[value='2']").text();
$(this).find("option:selected").text();
element.options[element.selectedIndex].text
Consider the following code snippet:
$.map(array1, function1);
Which of the following arguments is/are valid arguments of function1?
The index of the element to be translated in array1.
The item to be translated.
function1 has no arguments.
Both the index of the element to be translated in array1 and the item to be translated.
How can jQuery be used or optimized in such a way that the web applications can become richer and more functional?
var DED = (function() {
var private_var;
function private_method()
{
// do stuff here
}
return {
method_1 : function()
{
// do stuff here
},
method_2 : function()
{
// do stuff here
}
};
})();
// file: survey.js
$(document).ready(function() {
var jS = $('#surveycontainer');
var jB = $('#dimscreencontainer');
var d = new DimScreen({container: jB});
var s = new Survey({container: jS, DimScreen: d});
s.show();
});
Exc.ui.domTips = function (dom, tips) {
this.dom = gift;
this.tips = tips;
this.internal = {
widthEstimates: function (tips) {
...
}
formatTips: function () {
...
}
};
...
};
<script src="jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
var AcmeJQ = jQuery.noConflict(true);
var Acme = {fn: function(){}};
(function($){
Acme.sayHi = function()
{
console.log('Hello');
};
Acme.sayBye = function()
{
console.log('Good Bye');
};
})(AcmeJQ);
</script>
Which of the following statements returns the number of matched elements of $('.class1')?
$('.class1').size();
count($('.class1'));
$('.class1').count;
None of these
Which of the following will make the background of a page change, upon being refreshed?
$(document).ready(function() {
var totalCount = 2;
var num = Math.ceil( Math.random() * totalCount );
document.body.background = 'assets/background-'+num+'.jpg';
});
$(document).ready(function() {
var num = Math.ceil( Math.random() * totalCount );
document.body.background = 'assets/background-'+num+'.jpg';
});
$(document).ready(function() {
var totalCount = 2;
var num = Math( Math.random() * totalCount );
document.body.background = 'assets/background-'+num+'.jpg';
});
$(document).ready(function() {
var totalCount = 2;
var num = Math.ceil( Math.random() * totalCount );
document.background = 'assets/background-'+num+'.jpg';
});
Which of the following is the correct way to use jQuery with node.js?
By including jQuery library file
By installing jQuery npm module
By directly using jQuery without jQuery library file and jQuery npm module
By including jQuery library file and installing jQuery npm module
How can an additional row be added to a table as the last row using jQuery?
$('#myTable tr:last').after('<tr>...</tr><tr>...</tr>');
add_new_row('#myTable','<tr><td>my new row</td></tr>');
$('#myTable > tbody:last').append('<tr>...</tr><tr>...</tr>');
$('#myTable tr:end').after('<tr>...</tr><tr>...</tr>');
Which of the following is the best method for adding options to a select from a JSON object using jQuery?
selectValues = { "1": "test 1", "2": "test 2" };
for (key in selectValues) {
if (typeof (selectValues[key] == 'string') {
$('#mySelect').append('<option value="' + key + '">' + selectValues[key] + '</option>');
}
}
$.each(selectValues, function(key, value) {
$('#mySelect')
.append($("<option></option>")
.attr("value",key)
.text(value));
});
$.each(selectValues, function(key, value) {
$('#mySelect')
.append($("<option>")
.attr("value",key)
.text(value));
});
$.each(selectValues, function(key, value) {
$('#mySelect')
.append($("<option>")
.text(value));
});
Which of the following is the correct way to refresh a page with jQuery?
location.reload()
$(âhtmlâ).refresh()
$(âhtmlâ).load()
$(âhtmlâ).reload()
Which of the following functions moves p tags that have para class to div with content id?
function moveElement() {
$('p.para').each(function(index) {
$(this).appendTo('#content');
});
}
function moveElement() {
$('p.para').each(function(index) {
$(this).append('#content');
});
}
function moveElement() {
$('p.para').each(function(index) {
$(this).insertAfter('#content');
});
}
function moveElement() {
$('p.para').each(function(index) {
$(this).after('#content');
});
}
Which of the following is the correct way to check the existence of an element in jQuery other than the following code?
if ($(selector).length>0) {
// Do something
}
jQuery.fn.exists = function(){return this.length>0;}
if ($(selector).exists()) {
// Do something
}
jQuery.fn = function(){return this.length>0;}
if ($(selector).exists()) {
// Do something
}
jQuery.exists = function(selector) {return ($(selector).length > 0);}
if ($.exists(selector)) { }
jQuery.fn.exists = function(selector) {
return selector ? this.find(selector).length : this.length;
};
The css() function allows you to ___.
change the CSS class attribute.
change the CSS file path.
apply the CSS class to an element.
change the inline style attribute of an element.
Which option is correct to use the below function to set cursor position for textarea?
Function:
$.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
$('#elem').selectRange(3,5);
$('#elem').selectRange(3 5);
$('#elem').selectRange(X:3,Y:5);
$('#elem').fn.selectRange(3,5);
Consider the following code snippet:
<form id="form1">
<input type="text" id="text1" value="default" />
<input type="text" name="email" />
</form>
<script type="text/javascript">
function submitForm1() {
alert($('#form1').serialize());
}
</script>
What does the alert box display when the function submitForm1 is called?
email=
email=&text1=default
text1=&text2=
Nothing is shown in the alert box.
Which of the following is the correct way to move an element into another element?
$('#source').prependTo('#destination');
$("#source").add("#destination");
$("#source").html("#destination");
$("#source").add().html().("#destination");