MCQs > IT & Programming > JQuery MCQs > Basic jQuery MCQs

Basic jQuery MCQ

1. What is a particular performance concern when dealing with event handlers, and how can you cope with it?

Answer

Correct Answer: Some events, such as mousemove and scroll, happen a lot on a typical page. Debounce or throttle their handlers to make sure the handlers are not called more than you actually need.

Note: This Question is unanswered, help us to find answer for this one

2. If you JavaScript project involves a lot of DOM manipulation, but no AJAX or animation, which version of jQuery should you use?

Answer

Correct Answer: None of these - jQuery requires AJAX

Note: This Question is unanswered, help us to find answer for this one

3. What is the main difference between the contents() and children() functions?

Answer

Correct Answer: They both return the content of selected nodes, but contents() also includes text and comment nodes.

Note: This Question is unanswered, help us to find answer for this one

4. You want to implement the behavior of an effect like slideDown() manually using animate(). What is one critical point you need to remember?

Answer

Correct Answer: SlideDown() includes toggling visibility automatically. animate() does not automatically set any properties.

Note: This Question is unanswered, help us to find answer for this one

5. JQuery can create event handlers that execute exactly once. How is this done?

Answer

Correct Answer: $('button').one('click', function() { console.log('this will only happen once'); });

Note: This Question is unanswered, help us to find answer for this one

6. Which property of the jQuery event object references the DOM object that dispatched an event?

Answer

Correct Answer: Target

Note: This Question is unanswered, help us to find answer for this one

7. Given this snippet of HTML, how can you get the value of the text field using jQuery?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

8. In some projects, jQuery is not included as a file with an obvious version number (if it has been run through a minifier or other code bundler, for example). How can you detect programmatically what version of jQuery is active?

Answer

Correct Answer: JQuery.fn.jquery

Note: This Question is unanswered, help us to find answer for this one

9. Given this checkbox, how can you determine whether a user has selected or cleared the checkbox?

Answer

Correct Answer: By checking the value of $('#same-address').prop('checked')

Note: This Question is unanswered, help us to find answer for this one

10. What is the difference between $('p').find('a') and $('p').children('a')?

Answer

Correct Answer: Children() traverses only one level down, whereas find() selects anything inside the original element

Note: This Question is unanswered, help us to find answer for this one

11. What does this line of code do? $('ul > li:first-child');

Answer

Correct Answer: Selects the first list item inside all unordered lists on the page

Note: This Question is unanswered, help us to find answer for this one

12. How can you ensure that some code executes only when a class active appears on an element?

Answer

Correct Answer: $('.element').hasClass('active')

Note: This Question is unanswered, help us to find answer for this one

13. Which describes how jQuery makes working with the DOM faster?

Answer

Correct Answer: JQuery code to perform DOM manipulation is shorter and easier to write, but does not make DOM operations faster.

Note: This Question is unanswered, help us to find answer for this one

14. When incorporating a plugin into a project, what are the important steps for basic installation and usage?

Answer

Correct Answer: The jQuery script tag must come first, followed by the plugin, followed by your custom scripts, all preferably at or near the bottom of the page.

Note: This Question is unanswered, help us to find answer for this one

15. When using the clone() function to duplicate an element, what is one of the main concerns your code needs to watch out for?

Answer

Correct Answer: The clone() function may result in elements with duplicate ID attributes.

Note: This Question is unanswered, help us to find answer for this one

16. How would you fire a callback when any AJAX request on a page has completed?

Answer

Correct Answer: $(document).ajaxComplete(function() { console.count('An AJAX request completed'); });

Note: This Question is unanswered, help us to find answer for this one

17. How do you change the current value of a text field with the class .form-item to "555-1212"?

Answer

Correct Answer: $('.form-item').val('555-1212');

Note: This Question is unanswered, help us to find answer for this one

18. How can you get an AJAX request to go through without triggering any of jQuery's AJAX events?

Answer

Correct Answer: Set the option global to false.

Note: This Question is unanswered, help us to find answer for this one

19. Along with DOM traversal and manipulation, jQuery offers several general-purpose helper functions that fill in some JavaScript gaps, especially before ES2015. Which is NOT a jQuery utility function?

Answer

Correct Answer: JQuery.isMobile, which can tell whether the user is using a mobile browser

Note: This Question is unanswered, help us to find answer for this one

20. What does $() mean in jQuery?

Answer

Correct Answer: It is an alias to the main core method of jQuery itself—the same as writing jQuery().

Note: This Question is unanswered, help us to find answer for this one

21. Let's say you have a page with just one link on it. How can you change the anchor tag so it links to example.com?

Answer

Correct Answer: $('a').attr('href', 'http://www.example.com')

Note: This Question is unanswered, help us to find answer for this one

22. You're working on a site that uses an old version of jQuery, and you want to update to a newer version. What's the most efficient way to do so?

Answer

Correct Answer: Install the newer version of jQuery as well as its Migrate plugin, fix all warnings, and uninstall the Migrate plugin.

Note: This Question is unanswered, help us to find answer for this one

23. Which CSS selectors can you NOT use in jQuery?

Answer

Correct Answer: None. All CSS selectors are compatible in jQuery.

Note: This Question is unanswered, help us to find answer for this one

24. What is the correct way to check how many paragraphs exist on a page using jQuery?

Answer

Correct Answer: $('p').length

Note: This Question is unanswered, help us to find answer for this one

25. You want to create a custom right-click menu. How might you start the code?

Answer

Correct Answer: $('#canvas').on('contextmenu', function(){ console.log('Handled a right-click') });

Note: This Question is unanswered, help us to find answer for this one

26. What is the main difference between selectors and filters?

Answer

Correct Answer: Selectors are used to find and select content in a page. Filters are used to refine the results of selectors.

Note: This Question is unanswered, help us to find answer for this one

27. Though jQuery offers visual effects, it is considered a best practice to use CSS to set up different states triggered by classes, where it makes sense. What's the easiest way to enable and disable a class bounce on an element with the ID dialog?

Answer

Correct Answer: $('#dialog').toggleClass('bounce')

Note: This Question is unanswered, help us to find answer for this one

28. Effects like show, hide, fadIn, and fadeOut can be called with no arguments, but can also take arguments for how long they should last. Which is NOT a duration argument supported by these functions?

Answer

Correct Answer: extreme

Note: This Question is unanswered, help us to find answer for this one

29. What is tricky about jQuery's nth- filters (:nth-child, :nth-of-type, etc.) relative to other filters?

Answer

Correct Answer: Referring to lists of items, they are 1-indexed (like CSS), not 0-indexed (like JavaScript).

Note: This Question is unanswered, help us to find answer for this one

30. You want to work with AJAX using a Promise-like interface instead of nested callback functions. What jQuery API should you use?

Answer

Correct Answer: JQuery.Deferred

Note: This Question is unanswered, help us to find answer for this one

31. When writing jQuery plugins, we often provide default options that may be overridden by the end user. What jQuery function is most useful for this purpose?

Answer

Correct Answer: $.extend

Note: This Question is unanswered, help us to find answer for this one

32. What is the difference between $('header').html() and $('header').text()?

Answer

Correct Answer: $('header').html() returns the inner HTML of the header. $('header').text() returns only the text

Note: This Question is unanswered, help us to find answer for this one

33. Generally speaking, when used on a web page, how should jQuery be installed, and why?

Answer

Correct Answer: Just before the closing body tag, because we want to avoid blocking other resources from loading, and we use the ready method to make sure our code fires after the DOM is ready

Note: This Question is unanswered, help us to find answer for this one

34. Given the following HTML, how could we use one line to hide or show the button?

Answer

Correct Answer: $('.btn-primary').toggle();

Note: This Question is unanswered, help us to find answer for this one

35. What does the following line of code do? jQuery('p')

Answer

Correct Answer: Selects all paragraphs on the page

Note: This Question is unanswered, help us to find answer for this one

36. Which of the following jQuery method can be used to make an ajax call?

Answer

Correct Answer: load( url, [data], [callback] )

Note: This Question is unanswered, help us to find answer for this one

37. Which of the following is a single global function defined in the jQuery library?

Answer

Correct Answer: jQuery()

Note: This Question is unanswered, help us to find answer for this one

38. Which of the following will get the first column of all tables using jQuery?

Answer

Correct Answer: $('table.tblItemTemplate td:first-child');

Note: This Question is unanswered, help us to find answer for this one

39. What does this code snippet do? $(function() { //code });

Answer

Correct Answer: All of the above

Note: This Question is unanswered, help us to find answer for this one

40. Which of the following values is/are valid argument(s) of eq() function?

Answer

Correct Answer: 1
'2'
-1

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

41. Which of the following jQuery object property displays version number of jQuery?

Answer

Correct Answer: .jquery

Note: This Question is unanswered, help us to find answer for this one

42. Is it true that we have to place the result of jQuery.getScript between tags in order to use the loaded script?

Answer

Correct Answer: No

Note: This Question is unanswered, help us to find answer for this one

43.

Which of the following statements is not correct? 

Answer

Correct Answer: Both 2 and 3.

Note: This Question is unanswered, help us to find answer for this one

44.

What is the result of the following code snippet? jQuery.unique([10, 20, 20, 30, 30, 10]); 

Answer

Correct Answer: [10, 20, 30].

Note: This Question is unanswered, help us to find answer for this one

45.

Which of the following correctly uses the replace() method? 

Answer

Correct Answer: var valr='r'; valr = valr.replace('r', 't'); $('.try').prepend('

'+valr+'
');

Note: This Question is unanswered, help us to find answer for this one

46.

Which jQuery method reduces the set of matched elements to the one at the specified index?

Answer

Correct Answer: eq(index)

Note: This Question is unanswered, help us to find answer for this one

47.

What does the parent selector do?

Answer

Correct Answer: Selects all elements that have at least one child node (either an element or text).

Note: This Question is unanswered, help us to find answer for this one

48.

How would you check if an HTML element with an id of someElement exists in the DOM?

Answer

Correct Answer: if ($(‘#someElement’).length)

Note: This Question is unanswered, help us to find answer for this one

49.

What does the method .one() do?

Answer

Correct Answer: Attach a handler to an event for the elements. The handler is executed at most once per element per event type.

Note: This Question is unanswered, help us to find answer for this one

50.

What does the method jQuery.getScript() do?

Answer

Correct Answer: Load a JavaScript file from the server using a GET HTTP request, then execute it.

Note: This Question is unanswered, help us to find answer for this one

51.

What is jQuery ? 

Answer

Correct Answer: JavaScript Library

Note: This Question is unanswered, help us to find answer for this one

52.

Which is the correct method to remove a property for the set of matched element?

Answer

Correct Answer: .removeProp()

Note: This Question is unanswered, help us to find answer for this one

53.

Which of the following jQuery method adds the specified class if it is not present or remove the specified class if it is present?

Answer

Correct Answer: toggleClass(class)

Note: This Question is unanswered, help us to find answer for this one

54.

Which of the following jQuery method gets the children of each element in the set of matched elements?

Answer

Correct Answer: children(selector)

Note: This Question is unanswered, help us to find answer for this one

55.

Which jQuery method is used to perform an asynchronous HTTP request?

Answer

Correct Answer: jQuery.ajax()

Note: This Question is unanswered, help us to find answer for this one

56.

Which of the following jQuery method remove all or the specified class(es) from the set of matched elements?

Answer

Correct Answer: removeClass(class)

Note: This Question is unanswered, help us to find answer for this one

57.

Which built-in method removes the last element from an array and returns that element?

Answer

Correct Answer: pop()

Note: This Question is unanswered, help us to find answer for this one

58.

How to select all element available in DOM with jQuery?

Answer

Correct Answer: $("*")

Note: This Question is unanswered, help us to find answer for this one

59.

What does the method css() in jQuery do?

Answer

Correct Answer: All of the mentioned

Note: This Question is unanswered, help us to find answer for this one

60.

Which of the following statements best describes the below code: $('span.item').each(function (index) { $(this).wrap('<p></p>'); });

Answer

Correct Answer: Wraps each span tag that has class item within a p tag.

Note: This Question is unanswered, help us to find answer for this one

61.

Which jQuery method can be used to get the style property of an element?

Answer

Correct Answer: css(propertyname)

Note: This Question is unanswered, help us to find answer for this one

62.

Which of the following method is used to create custom animations in jQuery?

Answer

Correct Answer: animation()

Note: This Question is unanswered, help us to find answer for this one

63.

Which of the following jQuery method loads and executes a JavaScript file using an HTTP GET request?

Answer

Correct Answer: jQuery.getScript( url, [callback] )

Note: This Question is unanswered, help us to find answer for this one

64.

Which of the following is the correct way to debug JavaScript/jQuery event bindings with Firebug or a similar tool?

Answer

Correct Answer: var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, value) { console.log(value) // prints "function() { console.log('clicked!') }" })

Note: This Question is unanswered, help us to find answer for this one

65.

Which of the following is the correct way to add an additional option and select it with jQuery?

Answer

Correct Answer: $('#mySelect').append('<option value="whatever">text</option>').val('whatever')

Note: This Question is unanswered, help us to find answer for this one

66.

Is there a way to show custom exception messages as an alert in a jQuery Ajax error message?

Answer

Correct Answer: jQuery.ajax({// just showing error property error: function(jqXHR,error, errorThrown) { if(jqXHR.status&&jqXHR.status==400){ alert(jqXHR.responseText); }else{ alert("Something went wrong"); } } });

Note: This Question is unanswered, help us to find answer for this one

67.

Which of the following will show an alert containing the content(s) of a database selection?

Answer

Correct Answer: $.ajax({ type: "GET", url: "process_file.php?comp_id="+comp_id, success: function (result) { alert(result); } });

Note: This Question is unanswered, help us to find answer for this one

68.

How can this date "/Date(1224043200000)/" be changed to a short date format?

Answer

Correct Answer: var date = new Date(parseInt(jsonDate.substr(6)));

Note: This Question is unanswered, help us to find answer for this one

69.

Which of the following is/are correct to chain your plugin?

Answer

Correct Answer: (function($) { $.fn.helloWorld = function( customText ) { return this.each( function() { $(this).text( customText ); }); } }(jQuery));
(function($) { $.fn.helloWorld = function() { return this.each( function() { $(this).text("Hello, World!"); }); } }(jQuery));

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

70.

How would you successfully fetch some JSON data?

Answer

Correct Answer: $.getJSON(‘data.json', function(results) { // do something });
$.ajax({ type: ‘get’, url : ‘data.json', data : someData, dataType : 'json', success : function(results) { // do something }) });

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

71.

Please select the most efficient way(s) of appending a lot of elements to the DOM:

Answer

Correct Answer: var fragment = document.createDocumentFragment(); $.each(elements, function(i, item) { var newListItem = document.createElement(‘li’); var itemText = document.createTextNode(item); newListItem.appendChild(itemText); fragment.appendChild(newListItem); }); $(‘#list’)[0].appendChild(fragment);
var output = ‘’; $.each(elements, function(i, item) { output += ‘

  • ’ + item + ‘
  • ’; }); $(‘#list’).html(output);

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    72.

    Which of the following methods are no longer available in jQuery?

    Answer

    Correct Answer: bind()
    live()
    load()
    size()

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    73.

    Which of the following selectors are not part of the CSS specification and therefore cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method?

    Answer

    Correct Answer: :checkbox
    :image

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    74.

    Which of the following is/are correct to set the src attribute of an image?

    Answer

    Correct Answer: $("#image").attr("src", "photo.jpg");
    $("#image").attr( {"src": "photo.jpg" });

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    75.

    Which of the following can be used to slide object?

    Answer

    Correct Answer: slideDown()
    slideToggle()
    slideUp()
    animate()

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    76.

    How would you check if a checkbox element is checked?

    Answer

    Correct Answer: $('input[type="checkbox”]’).is(‘:checked’);
    $(‘input[type=“checkbox”]’).prop(‘checked’);

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    77.

    Which of the following is/are correct to attach a click event method that handles the click event of an element?

    Answer

    Correct Answer: $(".content h2").click(function() { // Code goes here });
    $(".content h2").on("click", "h2", function() { // Code goes here });

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    78.

    Which of the following is correct to create an event and trigger it artificially?

    Answer

    Correct Answer: var e = jQuery.Event("click"); jQuery("body").trigger(e);

    Note: This Question is unanswered, help us to find answer for this one

    79.

    Which of the following ajax call is correct?

    Answer

    Correct Answer: $.ajax({ type: "get", url: "hello.xml", dataType: "xml" });

    Note: This Question is unanswered, help us to find answer for this one

    80.

    In $.ajax call which of the following property settings is used to receive data upon successful completion of request?

    Answer

    Correct Answer: success:

    Note: This Question is unanswered, help us to find answer for this one

    81.

    Which of the following is not an ajax function settings?

    Answer

    Correct Answer: xml

    Note: This Question is unanswered, help us to find answer for this one

    82.

    Which of the following should be placed in the code below to alert data passed to event handler? function myHandler( event ) { // code .. select from the options below } $( "#box").on( "click", { foo: "bar" } , myHandler );

    Answer

    Correct Answer: alert( event.data.foo);

    Note: This Question is unanswered, help us to find answer for this one

    83.

    Select the fastest and most efficient way of hiding elements:

    Answer

    Correct Answer: $('#someElement’).find('p.someClass').hide();

    Note: This Question is unanswered, help us to find answer for this one

    84.

    Which of the following is correct to create default options for plugin, provided we pass 'options' to function?

    Answer

    Correct Answer: var settings = $.extend({ text : 'Hello, World!', color : red, }, options);

    Note: This Question is unanswered, help us to find answer for this one

    85.

    How would you construct a performant array loop?

    Answer

    Correct Answer: $.each(myArray, function(index, value) { // do domething });

    Note: This Question is unanswered, help us to find answer for this one

    86.

    Which of the following is better approach to create jQuery plugin?

    Answer

    Correct Answer: (function( $ ) { $.fn.menu = function( action ) { if ( action === "open") { // Open Menu code. } if ( action === "close" ) { // Close Close code. } }; }( jQuery ));

    Note: This Question is unanswered, help us to find answer for this one

    87.

    Which of the following is correct to select all elements having external site link?

    Answer

    Correct Answer: $("a[href^='http://']");

    Note: This Question is unanswered, help us to find answer for this one

    88.

    What does jQuery .queue() function do?

    Answer

    Correct Answer: Queue up animation functions so they can run asynchronously.

    Note: This Question is unanswered, help us to find answer for this one

    89.

    Please select the fastest jQuery selector example:

    Answer

    Correct Answer: $(‘#image’)

    Note: This Question is unanswered, help us to find answer for this one

    90.

    To wrap text in element and give id as "title"?

    Answer

    Correct Answer: $("h1").wrapInner("<a id='title'></a>");

    Note: This Question is unanswered, help us to find answer for this one

    91.

    Which of the following code can be used to stop default form submission?

    Answer

    Correct Answer: $("form").submit(function(e){ e.preventDefault(); });

    Note: This Question is unanswered, help us to find answer for this one

    92.

    Which of the following is not correct to animate CSS properties?

    Answer

    Correct Answer: $(".header").click(function() { $("#box").animate({background: "red"}); });

    Note: This Question is unanswered, help us to find answer for this one

    93.

    Which of the following is correct to remove id attribute from all H2 elements with in the "content" class?

    Answer

    Correct Answer: $(".content h2").removeAttr("id");

    Note: This Question is unanswered, help us to find answer for this one

    94.

    Which of the following is correct to clone the tag in an and insert them after the tag inside tag?

    Answer

    Correct Answer: $("article a").clone().insertAfter($("aside h2"));

    Note: This Question is unanswered, help us to find answer for this one

    95.

    You have a jQuery : $(".slides img").first().fadeOut(500).next().fadeIn(1000).end().appendTo(".slides"); Which one of the following will be correct?

    Answer

    Correct Answer: Append whole set of img elements to ".slides"

    Note: This Question is unanswered, help us to find answer for this one

    96.

    How would you disable an HTML button element with id myButton?

    Answer

    Correct Answer: $(‘#myButton’).prop(‘disabled’, true);

    Note: This Question is unanswered, help us to find answer for this one

    97.

    Which of the following is correct to remove first element in an article?

    Answer

    Correct Answer: $("article a:first").remove();

    Note: This Question is unanswered, help us to find answer for this one

    98.

    Which of the following will detect a change in the value of a hidden input?

    Answer

    Correct Answer: None of these.

    Note: This Question is unanswered, help us to find answer for this one

    99.

    Which of the following is the best way to retrieve checkbox values in jQuery?

    Answer

    Correct Answer: $('#cb :checked').each(function() { $(this).val(); });

    Note: This Question is unanswered, help us to find answer for this one

    100.

    Which is the fastest method to change the css of more than 20 elements on a page?

    Answer

    Correct Answer: $(’<style type=“text/css”>img.thumbnail { border: 1px solid #333; }</style>’).appendTo(‘head’);

    Note: This Question is unanswered, help us to find answer for this one

    101.

    Which is the fastest way of adding a lot of rows to a table?

    Answer

    Correct Answer: $(‘#table tr:last').after('<tr><td>table row #1</td></tr> […] <tr><td>table row #100</td></tr>');

    Note: This Question is unanswered, help us to find answer for this one

    102.

    Which of the following jQuery method gets the combined text contents of an element?

    Answer

    Correct Answer: text()

    Note: This Question is unanswered, help us to find answer for this one

    103.

    Which of the following jQuery selector selects element with the given element id some-id?

    Answer

    Correct Answer: $('#some-id')

    Note: This Question is unanswered, help us to find answer for this one

    104.

    Which of the following jQuery method sets the width property of an element?

    Answer

    Correct Answer: width( value )

    Note: This Question is unanswered, help us to find answer for this one

    105.

    Which of the following jQuery method stops the rest of the event handlers from being executed?

    Answer

    Correct Answer: stopImmediatePropagation( )

    Note: This Question is unanswered, help us to find answer for this one

    106.

    What is the correct jQuery code to set the background color of all p elements to green?

    Answer

    Correct Answer: $(“p”).css(“background-color”,”green”);

    Note: This Question is unanswered, help us to find answer for this one

    107.

    Which of the following jQuery method setups default values for future AJAX requests?

    Answer

    Correct Answer: jQuery.ajaxSetup( options )

    Note: This Question is unanswered, help us to find answer for this one

    108.

    What does the jQuery .clone() function do?

    Answer

    Correct Answer: Create a deep copy of the set of matched elements including any attached events.

    Note: This Question is unanswered, help us to find answer for this one

    109.

    Which is the method that operates on the return value of $()

    Answer

    Correct Answer: css()

    Note: This Question is unanswered, help us to find answer for this one

    110.

    Which of the following jQuery method finds all sibling elements?

    Answer

    Correct Answer: siblings(selector)

    Note: This Question is unanswered, help us to find answer for this one

    111.

    Which of the following jQuery method gets a set of elements containing the closest parent element that matches the specified selector, the starting element included?

    Answer

    Correct Answer: closest(selector)

    Note: This Question is unanswered, help us to find answer for this one

    112.

    What is the difference between the .position() and the .offset() method?

    Answer

    Correct Answer: The .position() method retrieves the current position relative to the offset parent, whereas the .offset() method retrieves the current position of an element relative to the document.

    Note: This Question is unanswered, help us to find answer for this one

    113.

    Standard effects queue in jQuery is named as?

    Answer

    Correct Answer: fx

    Note: This Question is unanswered, help us to find answer for this one

    114.

    Which of the following jQuery method returns the outer height (including the border) of an element?

    Answer

    Correct Answer: outerHeight( [margin] )

    Note: This Question is unanswered, help us to find answer for this one

    115.

    Which of the following is not a jQuery utility method?

    Answer

    Correct Answer: $.ajax()

    Note: This Question is unanswered, help us to find answer for this one

    116.

    How can an object be serialized to JSON with jQuery's standard methods?

    Answer

    Correct Answer: var json_text = JSON.stringify(your_object, null, 2);
    var your_object = JSON.parse(json_text);

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    117.

    Which of the following jQuery method gets the current offset of the first matched element, in pixels, relative to the document?

    Answer

    Correct Answer: offset( )

    Note: This Question is unanswered, help us to find answer for this one

    118.

    Which of the following jQuery method binds a handler to one or more events (like click) for an element?

    Answer

    Correct Answer: bind( type, [data], fn )

    Note: This Question is unanswered, help us to find answer for this one

    119.

    Which of the following jQuery method checks if event.preventDefault() was ever called on this event object?

    Answer

    Correct Answer: isDefaultPrevented( )

    Note: This Question is unanswered, help us to find answer for this one

    120.

    Which are the correct ways of listening for when the DOM is ready to be manipulated?

    Answer

    Correct Answer: $(document).ready(function() { // DOM is ready });
    $(function() { // DOM is ready });

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    121.

    Which of the following jQuery method serializes a set of input elements into a string of data?

    Answer

    Correct Answer: serialize( )

    Note: This Question is unanswered, help us to find answer for this one

    122.

    Which built-in method returns the calling string value converted to lower case?

    Answer

    Correct Answer: toLowerCase()

    Note: This Question is unanswered, help us to find answer for this one

    123.

    Which of the following jQuery method can be used to attach a function to be executed whenever AJAX request completed successfully?

    Answer

    Correct Answer: ajaxStop(callback)

    Note: This Question is unanswered, help us to find answer for this one

    124.

    Which of the following methods allow us to insert new content surrounding existing content?

    Answer

    Correct Answer: All of the mentioned

    Note: This Question is unanswered, help us to find answer for this one

    125.
    What is the best method to select all the radio inputs on a page?
     

     

    Answer

    Correct Answer: $(‘input:radio’);

    Note: This Question is unanswered, help us to find answer for this one

    126.
    Which is the correct method to remove all matched elements from the DOM?
     

    Answer

    Correct Answer: remove( expr)

    Note: This Question is unanswered, help us to find answer for this one

    127.
    Which of the following jQuery selector selects elements by tag name?
     

     

    Answer

    Correct Answer: $('tag')

    Note: This Question is unanswered, help us to find answer for this one

    128.
    Which of the following jQuery method gets the height property of an element?
     

     

    Answer

    Correct Answer: height()

    Note: This Question is unanswered, help us to find answer for this one

    129.
    What will the following code do: $(document).ready(function() { $(this).bind("contextmenu", function(e) { e.preventDefault(); }); });

     

    Answer

    Correct Answer: don't show context menu on page when right clicked.

    Note: This Question is unanswered, help us to find answer for this one

    130.
    Which of the following jQuery method prevents the browser from executing the default action?

     

    Answer

    Correct Answer: preventDefault( )

    Note: This Question is unanswered, help us to find answer for this one

    131.

    To select all the s and the s in a page?

    Answer

    Correct Answer: $('div, span');

    Note: This Question is unanswered, help us to find answer for this one

    132.

    Which built-in method returns the length of the string?

    Answer

    Correct Answer: length()

    Note: This Question is unanswered, help us to find answer for this one

    133.

    What is the output of the following program? #include main() { char s[] = "Hello\0Hi"; printf("%d %d", strlen(s), sizeof(s)); }

    Answer

    Correct Answer: 5 9

    Note: This Question is unanswered, help us to find answer for this one

    134.

    Which one of the following is not a jQuery function to get Ajax data?

    Answer

    Correct Answer: getAjax()

    Note: This Question is unanswered, help us to find answer for this one

    135.

    Which function can be used to prevent the default action of an event?

    Answer

    Correct Answer: event.preventDefault();

    Note: This Question is unanswered, help us to find answer for this one

    136.

    How to select all button elements in DOM?

    Answer

    Correct Answer: $( ":button" )

    Note: This Question is unanswered, help us to find answer for this one

    137.

    Which of the following jQuery method retrieves all the elements contained in the jQuery set, as an array?

    Answer

    Correct Answer: toArray()

    Note: This Question is unanswered, help us to find answer for this one

    138.

    Which of the following jQuery method checks whether a supplied callback is in a list?

    Answer

    Correct Answer: callbacks.has(foo)

    Note: This Question is unanswered, help us to find answer for this one

    139.

    What does the :selected selector do?

    Answer

    Correct Answer: Selects all elements that are selected.

    Note: This Question is unanswered, help us to find answer for this one

    140.

    What does the method .empty() do?

    Answer

    Correct Answer: Remove all child nodes of the set of matched elements from the DOM.

    Note: This Question is unanswered, help us to find answer for this one

    141.

    Which jQuery method should be used to deal with name conflicts?

    Answer

    Correct Answer: noConflict()

    Note: This Question is unanswered, help us to find answer for this one

    142.

    $.extend(false, obj1, obj2, obj3); What does the above code do?

    Answer

    Correct Answer: Extends the obj1 by merging obj2 and obj3 with obj1.

    Note: This Question is unanswered, help us to find answer for this one

    143.

    Which of the following method returns all ancestor elements between a and a element?

    Answer

    Correct Answer: Both 1 and 2

    Note: This Question is unanswered, help us to find answer for this one

    144.

    How jQuery hide() function works?

    Answer

    Correct Answer: sets “display” inline style attribute of that element to “none”.

    Note: This Question is unanswered, help us to find answer for this one

    145.

    Which of the following is not correct value for dataType when making Ajax request?

    Answer

    Correct Answer: sql

    Note: This Question is unanswered, help us to find answer for this one

    146.

    What selector would you use to query for all elements with an ID that ends with a particular string, for example ‘txtTitle’ ?

    Answer

    Correct Answer: $("[id$='txtTitle']")

    Note: This Question is unanswered, help us to find answer for this one

    147.

    What is the correct syntax to create a method in jQuery plugin? Assume that methodName is the name of the method and methodDefinition is the definition of the method.

    Answer

    Correct Answer: jQuery.fn.methodName = methodDefinition;

    Note: This Question is unanswered, help us to find answer for this one

    148.

    How basic authorization can be used with jQuery ajax request?`

    Answer

    Correct Answer: $.ajax({ ... headers: { 'Authorization':'Basic xxxxxxxxxxxxx', }, ... });

    Note: This Question is unanswered, help us to find answer for this one

    149.

    What is the most efficient way to load your code once DOM tree has loaded (without waiting for external resources)?

    Answer

    Correct Answer: jQuery(document).ready(function() { / your code here });

    Note: This Question is unanswered, help us to find answer for this one

    150.

    How to check which key was pressed using jQuery?

    Answer

    Correct Answer: $('#selector').keypress(function (event) { alert(String.fromCharCode((event.keyCode))); });

    Note: This Question is unanswered, help us to find answer for this one

    151.

    What does the event.stopPropagation() function does?

    Answer

    Correct Answer: Bubbles up the DOM tree, preventing any parent handlers from being notified of the event.

    Note: This Question is unanswered, help us to find answer for this one

    152.

    Which of the following will stop user from writing into a text box?

    Answer

    Correct Answer: $( "input[type=text]" ).focus(function() { $(this).blur(); });

    Note: This Question is unanswered, help us to find answer for this one

    153.

    Which of the following code snippets can be used to get the ID of the element that fired an event?

    Answer

    Correct Answer: e.All of the above

    Note: This Question is unanswered, help us to find answer for this one

    154.

    Which of the following jQuery method adds the previous selection to the current selection?

    Answer

    Correct Answer: andSelf( )

    Note: This Question is unanswered, help us to find answer for this one

    155.

    Which of the following is the best method for adding options to a select from a JSON object using jQuery?

    Answer

    Correct Answer: $.each(selectValues, function(key, value) { $('#mySelect') .append($("<option></option>") .attr("value",key) .text(value)); });

    Note: This Question is unanswered, help us to find answer for this one

    156.

    Which of the following is correct for selectors in jQuery?

    Answer

    Correct Answer: A B Matches all elements with tag name A that are descendants of B A>B Matches all elements with tag name A that are direct children of B A+B Matches all elements with tag name A that are immediately preceded by sibling B A-B Matches all elements with tag name A preceded by any sibling B

    Note: This Question is unanswered, help us to find answer for this one

    157.

    Which of the following is the correct way to get the value of a textbox using id in jQuery?

    Answer

    Correct Answer: $(“#textbox”).val()

    Note: This Question is unanswered, help us to find answer for this one

    158.

    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();?

    Answer

    Correct Answer: html and body

    Note: This Question is unanswered, help us to find answer for this one

    159.

    Which of the following is the correct way to get <div> in the center of the screen using jQuery?

    Answer

    Correct Answer: $('your-selector').position({ of: $(window) });

    Note: This Question is unanswered, help us to find answer for this one

    160.

    Which of the following is the correct way to move an element into another element?

    Answer

    Correct Answer: $('#source').prependTo('#destination');

    Note: This Question is unanswered, help us to find answer for this one

    161.

    $('ul#myId > li'); What does the above statement return?

    Answer

    Correct Answer: A set of li tags which are children of ul tags that have "myId" id.

    Note: This Question is unanswered, help us to find answer for this one

    162.

    Which of the following is the correct way to assign a selected value of a drop-down list using jQuery?

    Answer

    Correct Answer: $(".myDDL").val('2');

    Note: This Question is unanswered, help us to find answer for this one

    163.

    Which of the following is the correct way to select all elements whose id contains string "test" using jQuery?

    Answer

    Correct Answer: $("[id*='test']")

    Note: This Question is unanswered, help us to find answer for this one

    164.

    How can an Ajax request that has not yet received a response be canceled or aborted?

    Answer

    Correct Answer: //xhr is an Ajax variable Xhr .abort()

    Note: This Question is unanswered, help us to find answer for this one

    165.

    Consider the following code snippet:

    $(document).com(‘click’ , “ul.item” ,function (evt)  {

    Evt . preventDefault();

                   Console.log(this);

    });

    What will be returned to be console?

    Answer

    Correct Answer: All ul elements that belong to the class, “item”
    #document

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    166.

    If jQuery is included before another library, how can conflict between jQuery and that library be avoided?

    Answer

    Correct Answer: By using the jQuery object when working with the jQuery library and using the $ object for other libraries.

    Note: This Question is unanswered, help us to find answer for this one

    167.

    Consider the following code snippet:

    $(‘#table1’).find( ‘tr’ ).hide().slice(10, 20).show();

    What is the result of this code snippet?

    Answer

    Correct Answer: Showing table1’s rows from 11th to 20th.

    Note: This Question is unanswered, help us to find answer for this one

    168.

    A <doctype> defines the document type of any XHTML document. It can be of three types:

    Answer

    Correct Answer: Strict, Transitional, and Frameset

    Note: This Question is unanswered, help us to find answer for this one

    169.

    Which of the following function can be used to attach event handler to an element?

    Answer

    Correct Answer: bind

    Note: This Question is unanswered, help us to find answer for this one

    170.

    Consider the following code snippet:

    $.map (array1, function1 );

    Which of the following arguments is/are valid arguments of function1?

    Answer

    Correct Answer: Both the index of the element to be translated in array1 and the item to be translated

    Note: This Question is unanswered, help us to find answer for this one

    171.

    Which of the following is the correct way to do the following JavaScript Code with jQuery?

    var d = document;

    var odv = d.createElement ("div") ;

    this. OuterDiv = odv;

    var t = d.createElement ("table") ;

    t.cellspacing = 0;

    t.className = "text";

    odv.appendChild(t) ;

    Answer

    Correct Answer: var t = $ ( "<table cellspacing = '0' class= 'text'></table>" ) ; $.append (t);

    Note: This Question is unanswered, help us to find answer for this one

    172.

    $.grep (array1, function1);

    The above statement _____ the elements of array1 array which satisfy function1 function.

    Answer

    Correct Answer: remove

    Note: This Question is unanswered, help us to find answer for this one

    173.

    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 snippets return(s) a set of all li tags within "id1" except for li tag with id "li2"?

    Answer

    Correct Answer: $('#id1 li').not($('#li2'));

    Note: This Question is unanswered, help us to find answer for this one

    174.

    Which of the following is the correct way to select an option based on its text in jQuery?

    Answer

    Correct Answer: $("#myselect option").filter(function(){ return $(this).text() == 'text';}).prop('selected', true);

    Note: This Question is unanswered, help us to find answer for this one

    175.

    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 }

    Answer

    Correct Answer: jQuery.fn.exists = function(){return this.length>0;} if ($(selector).exists()) { // Do something }

    Note: This Question is unanswered, help us to find answer for this one

    176.

    What will be the message in the alert box?

    <div class="selector">Text mates</div>

    <div class="selector">Text mates2</div>

    alert(jQuery('.selector').text().length);

    Answer

    Correct Answer: 21

    Note: This Question is unanswered, help us to find answer for this one

    177.

    Which of the following is the correct way to get the value of a selected radio button from two radio buttons with jQuery?

    Answer

    Correct Answer: $("input[name='radioName']:checked").val()

    Note: This Question is unanswered, help us to find answer for this one

    178.

    How can jQuery be used or optimized in such a way that the web applications can become richer and more functional?

    Answer

    Correct Answer: <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>

    Note: This Question is unanswered, help us to find answer for this one

    179.

    The innerHeight function returns the inner height of an element, ___ the border and ___ the padding.

    Answer

    Correct Answer: excludes, includes

    Note: This Question is unanswered, help us to find answer for this one

    180.

    Which of the following will make the background of a page change, upon being refreshed?

    Answer

    Correct Answer: $(document).ready(function() { var totalCount = 2; var num = Math.ceil( Math.random() * totalCount ); document.body.background = 'assets/background-'+num+'.jpg'; });

    Note: This Question is unanswered, help us to find answer for this one

    181.

    How can an additional row be added to a table as the last row using jQuery?

    Answer

    Correct Answer: $('#myTable > tbody:last').append('<tr>...</tr><tr>...</tr>');

    Note: This Question is unanswered, help us to find answer for this one

    182.

    Which of the following is the best way to open a jQuery UI dialog box without a title bar?

    Answer

    Correct Answer: $(".ui- dialog-titlebar").hide();

    Note: This Question is unanswered, help us to find answer for this one

    183.

    Which option can be used to have jQuery wait for all images to load before executing something on a page?

    Answer

    Correct Answer: 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.

    Note: This Question is unanswered, help us to find answer for this one

    184.

    What is the result of NaN == NaN? 

    Answer

    Correct Answer: false

    Note: This Question is unanswered, help us to find answer for this one

    185.

    Which of the following is the correct way to select <a> on the basis of href using jQuery?

    Answer

    Correct Answer: jQuery("a attr[href='url']")

    Note: This Question is unanswered, help us to find answer for this one

    186.

    Whats the right way to access the contents of an iframe using jQuery?

    Answer

    Correct Answer: If the <iframe> is from the same domain, the elements are easily accessible as $("#iFrame").contents().find("#someDiv").removeClass("hidden");

    Note: This Question is unanswered, help us to find answer for this one

    187.

    Which of the following is the correct way to get HTML encoded value for any tag which function can be used?

    Answer

    Correct Answer: function htmlEncode(value){ return $('<div/>').html(); }

    Note: This Question is unanswered, help us to find answer for this one

    188.

    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?

    Answer

    Correct Answer: $(element).is(":visible")

    Note: This Question is unanswered, help us to find answer for this one

    189.

    Which of the following statements returns the number of matched elements of $('.class1')?

    Answer

    Correct Answer: $('.class1').size();

    Note: This Question is unanswered, help us to find answer for this one

    190.

    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?

    Answer

    Correct Answer: email=

    Note: This Question is unanswered, help us to find answer for this one

    191.

    Which of the following is an example of a cross-browser compatible way of binding click events?

    Answer

    Correct Answer: None of these.

    Note: This Question is unanswered, help us to find answer for this one

    192.

    jQuery allows you to use ___ function to switch between showing and hiding an element.

    Answer

    Correct Answer: toggle

    Note: This Question is unanswered, help us to find answer for this one

    193.

    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 animations of this code snippet are:

    Answer

    Correct Answer: .second-row will slide up, then the targeted parent sibling .second-row will slide down.

    Note: This Question is unanswered, help us to find answer for this one

    194.

    Which of the following is the correct way to use jQuery with node.js?

    Answer

    Correct Answer: By including jQuery library file and installing jQuery npm module

    Note: This Question is unanswered, help us to find answer for this one

    195.

    $.merge(array1, array2); The above function merges ___.

    Answer

    Correct Answer: array1 with array2 and returns the result.

    Note: This Question is unanswered, help us to find answer for this one

    196.

    Which of the following is the correct way to distinguish left and right mouse click event in jQuery? 

    Answer

    Correct Answer: event.which

    Note: This Question is unanswered, help us to find answer for this one

    197.

    Which of the following makes use of jQuery to select multiple elements?

    Answer

    Correct Answer: $('table td:eq(0), table td:eq(5), table td:eq(9)')

    Note: This Question is unanswered, help us to find answer for this one

    198.

    What is the best approach to reset the entire form with JQuery?

    Answer

    Correct Answer: $(":input").not(":button, :submit, :reset, :hidden").each( function() { this.value = this.defaultValue; });

    Note: This Question is unanswered, help us to find answer for this one

    199.

    Which of the following functions moves p tags that have para class to div with content id?

    Answer

    Correct Answer: function moveElement() { $('p.para').each(function(index) { $(this).appendTo('#content'); }); }

    Note: This Question is unanswered, help us to find answer for this one

    200.

    Which of the following is correct with regards to how to upload a file asynchronously with jQuery?

    Answer

    Correct Answer: 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).

    Note: This Question is unanswered, help us to find answer for this one

    201.

    Which of the following represents the best way to make a custom right-click menu using jQuery?

    Answer

    Correct Answer: $(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"}); });

    Note: This Question is unanswered, help us to find answer for this one

    202.

    The css() function allows you to ___.

    Answer

    Correct Answer: change the inline style attribute of an element.

    Note: This Question is unanswered, help us to find answer for this one

    203.

    What is the difference between jQuery's .focusout() and .blur() events? 

    Answer

    Correct Answer: The .blur() event is sent to an element when it, or any element inside of it, loses focus, while the .focusout() event supports detecting the loss of focus from parent elements.

    Note: This Question is unanswered, help us to find answer for this one

    204.

    Which of the following is the correct way to check which key was pressed? 

    Answer

    Correct Answer: $('#txtValue').keypress(function(event){ alert( String.fromCharCode( (event.keyCode) ) ); });

    Note: This Question is unanswered, help us to find answer for this one

    205.

    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 ___.

    Answer

    Correct Answer: Both the width animation and the height animation occur at the same time.

    Note: This Question is unanswered, help us to find answer for this one

    206.

    How or where can a plugin be declared, so that the plugin methods are available for the script?

    Answer

    Correct Answer: In the head of the document, include the plugin after main jQuery source file, before the script file.

    Note: This Question is unanswered, help us to find answer for this one

    207.

    What is the purpose of $(document).ready() function in Jquery?

    Answer

    Correct Answer: To execute functions after DOM is loaded

    Note: This Question is unanswered, help us to find answer for this one

    208.

    How can the child img be selected inside the div with a selector?

    Answer

    Correct Answer: jQuery(this).find("img");

    Note: This Question is unanswered, help us to find answer for this one

    209.

    Offset function gets the current offset of the first matched element in pixels relative to the ___.

    Answer

    Correct Answer: parent element

    Note: This Question is unanswered, help us to find answer for this one

    210.

    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?

    Answer

    Correct Answer: New message

    Note: This Question is unanswered, help us to find answer for this one

    211.

    Consider the following code snippet:

    $('#button1').bind('click', function(data) {...});

    What is the data argument?

    Answer

    Correct Answer: Click event's data

    Note: This Question is unanswered, help us to find answer for this one

    212.

    $('#a1').one('click', {times: 3}, function1); Which of the following is true for the above?

    Answer

    Correct Answer: function1 will be executed once regardless of the number of times a1 is clicked.

    Note: This Question is unanswered, help us to find answer for this one

    213.

    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?

    Answer

    Correct Answer: function1, function2, and function3

    Note: This Question is unanswered, help us to find answer for this one

    214.

    Which of the following code snippets insert(s) the code snippet

    at the end of div tags?

    Answer

    Correct Answer: $('div').append('

    ');
    $('').appendTo('div');

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    215.

    The position function gets the ___ positions of an element that are relative to its offset parent.

    Answer

    Correct Answer: top and left

    Note: This Question is unanswered, help us to find answer for this one

    216.

    Which of the following functions will return an empty set when end() function is chained right after that function?

    Answer

    Correct Answer: remove

    Note: This Question is unanswered, help us to find answer for this one

    217.

    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?

    Answer

    Correct Answer: Yes

    Note: This Question is unanswered, help us to find answer for this one

    218.

    Which of the following is the correct use of ajaxStart() function?

    Answer

    Correct Answer: None of these.

    Note: This Question is unanswered, help us to find answer for this one

    219.

    Which of the following is the correct way to hide a menu div by clicking outside the menu div?

    Answer

    Correct Answer: $('html').click(function() { //Hide the menus if visible }); $('#menucontainer').click(function(event){ event.stopPropagation(); });

    Note: This Question is unanswered, help us to find answer for this one

    220.

    Which of the following is the correct way to manage a redirect request after a jQuery Ajax call?

    Answer

    Correct Answer: $.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(); } });

    Note: This Question is unanswered, help us to find answer for this one

    221.

    Consider having multiple $(document).ready() functions in one or many linked JavaScript files. Given this information, which of the following will be executed?

    Answer

    Correct Answer: All ready() functions

    Note: This Question is unanswered, help us to find answer for this one

    222.

    $('#id1').animate({width:"80%"}, "slow") The above code snippet will ___.

    Answer

    Correct Answer: animate the tag with id1 from the current width to 80% width.

    Note: This Question is unanswered, help us to find answer for this one

    223.

    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>

    Answer

    Correct Answer: $("#list option[value='2']").text();

    Note: This Question is unanswered, help us to find answer for this one

    224.

    Which of the following methods can be used to utilize the animate function with the backgroundColor style property?

    Answer

    Correct Answer: There is no way to use animate with that style property.

    Note: This Question is unanswered, help us to find answer for this one

    225.

    Which of the following functions is/are built-in jQuery regular expression function(s)?

    Answer

    Correct Answer: jQuery does not have built-in regular expression functions.

    Note: This Question is unanswered, help us to find answer for this one

    226.

    each() is a generic ___ function.

    Answer

    Correct Answer: iterator

    Note: This Question is unanswered, help us to find answer for this one

    227.

    How can the href for a hyperlink be changed using jQuery? 

    Answer

    Correct Answer: $("a").attr("href", "http://www.google.com/");

    Note: This Question is unanswered, help us to find answer for this one

    228.

    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?

    Answer

    Correct Answer: "fast"

    Note: This Question is unanswered, help us to find answer for this one

    229.

    jQuery allows simulating an event to execute an event handler as if that event has just occurred by using ___.

    Answer

    Correct Answer: trigger function

    Note: This Question is unanswered, help us to find answer for this one

    230.

    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(); } }); }; 

    Answer

    Correct Answer: $('#elem').selectRange(3,5);

    Note: This Question is unanswered, help us to find answer for this one

    231.

    The hide() function hides an element by ___.

    Answer

    Correct Answer: setting "display" inline style attribute of that element to "none".

    Note: This Question is unanswered, help us to find answer for this one

    232.

    What does $('tr.rowClass:eq(1)'); return?

    Answer

    Correct Answer: One element set which is the second row of the first table.

    Note: This Question is unanswered, help us to find answer for this one

    233.

    Which of the following methods can be used to copy element?

    Answer

    Correct Answer: clone

    Note: This Question is unanswered, help us to find answer for this one

    234.

    Which of the following events can be used to disable right click contextual menu?

    Answer

    Correct Answer: contextmenu

    Note: This Question is unanswered, help us to find answer for this one

    235.

    Assuming that the jQuery UI library is used to make a list sortable, which of the following code snippets makes "list1" sortable?

    Answer

    Correct Answer: $('#list1').sortable();

    Note: This Question is unanswered, help us to find answer for this one

    236.

    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? 

    Answer

    Correct Answer: The current div tag of the iteration.

    Note: This Question is unanswered, help us to find answer for this one

    237.

    Consider the following code snippet:

    function function1() {

        alert(arguments.length);

    }

    Which of the following is true when function1(); is run?

    Answer

    Correct Answer: The alert box displays 0.

    Note: This Question is unanswered, help us to find answer for this one

    238.

    One advantage of $.ajax function over $.get or $.post is that ___.

    Answer

    Correct Answer: $.ajax offers error callback option.

    Note: This Question is unanswered, help us to find answer for this one

    239.

    What is the result of this function: jQuery.makeArray ( true )?

    Answer

    Correct Answer: [ true ]

    Note: This Question is unanswered, help us to find answer for this one

    240.

    Which option is correct to perform a synchronous AJAX request?

    Answer

    Correct Answer: 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 }); }

    Note: This Question is unanswered, help us to find answer for this one

    241.

    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'));? 

    Answer

    Correct Answer: $('#li2').siblings();

    Note: This Question is unanswered, help us to find answer for this one

    242.

    Which of the following will select a particular option in a <select> element using its index?

    Answer

    Correct Answer: $('select option:eq(1)')

    Note: This Question is unanswered, help us to find answer for this one

    243. Consider the following code snippet:

    $('#table1 tr:odd').addClass('oddRow');
    $('#table1 tr:even').addClass('evenRow');

    The result of the above code snippet is ___.


    Answer

    Correct Answer: the odd rows of table1 have evenRow class, while the even rows have oddRow class

    Note: This Question is unanswered, help us to find answer for this one

    244. Is the following code snippet a valid ajax request?

    $.ajax({data: {'name': 'jQuery'},});


    Answer

    Correct Answer: Yes.

    Note: This Question is unanswered, help us to find answer for this one

    245. Which of the following statements return(s) a set of p tags that contain "jQuery"?


    Answer

    Correct Answer: a and b

    Note: This Question is unanswered, help us to find answer for this one

    246. Which of the following statements return(s) a set of even rows?


    Answer

    Correct Answer: b and c

    Note: This Question is unanswered, help us to find answer for this one

    247. is() function ___ the current selection against an expression.


    Answer

    Correct Answer: checks

    Note: This Question is unanswered, help us to find answer for this one

    248. Which of the following gets the href attribute of "id1"?


    Answer

    Correct Answer: $('#id1').attr('href');

    Note: This Question is unanswered, help us to find answer for this one

    249. Which of the following values is/are valid value(s) of secondArgument in addClass('turnRed', secondArgument); function, if we use jQuery UI library?


    Answer

    Correct Answer: 'fast'

    Note: This Question is unanswered, help us to find answer for this one

    250. What is the difference between $('p').insertBefore(arg1) and $('p').before(arg2) statement?


    Answer

    Correct Answer: The former inserts p tags before the tags specified by arg1, the latter inserts content specified by arg2 before all p tags.

    Note: This Question is unanswered, help us to find answer for this one

    251. Which of the following seems to be correct for ajaxStart(function()) method as shown in the below Code snippet?

    $("#div1").ajaxStart(function())


    Answer

    Correct Answer: Method Attaches a function to be executed whenever an AJAX request begins and there is none already activated.

    Note: This Question is unanswered, help us to find answer for this one

    252. Consider the following code snippet:

    $('#ul1 li').live('click', function1);
    $('#ul1').after('<li id="lastLi">Last item</li>');

    Is live is deprecated in jQuery 1.3.2?


    Answer

    Correct Answer: Yes

    Note: This Question is unanswered, help us to find answer for this one

    253. Which of the following methods can be used to utilize animate function with backgroundColor style property?


    Answer

    Correct Answer: Use jQuery UI library.

    Note: This Question is unanswered, help us to find answer for this one

    254. If you include jQuery after other library, how do you disable the use of $ as a shortcut for jQuery?


    Answer

    Correct Answer: By calling jQuery.noConflict(); right after including jQuery.

    Note: This Question is unanswered, help us to find answer for this one

    255. Assume that you need to build a function that manipulates an image when the image is loaded. Which of the following functions should you use?


    Answer

    Correct Answer: load

    Note: This Question is unanswered, help us to find answer for this one

    256. Which of the following commands creates a basic dialog containing this code snippet <div id="id1"> Simple dialog</div> using jQuery UI?


    Answer

    Correct Answer: $("#id1").dialog();

    Note: This Question is unanswered, help us to find answer for this one

    257. What does $('tr:nth-child(4)') return?


    Answer

    Correct Answer: A set of the fourth rows of the tables.

    Note: This Question is unanswered, help us to find answer for this one

    258. Which of the following functions can be used to bind an event handler to display a message when the window is closed, reloaded or navigated to another page?


    Answer

    Correct Answer: unload

    Note: This Question is unanswered, help us to find answer for this one

    259. Which of the following methods can be used to delete a specified tag?


    Answer

    Correct Answer: remove.

    Note: This Question is unanswered, help us to find answer for this one

    260. $.grep(array1, function1);

    The above statement ___ the elements of array1 array which satisfy function1 function.


    Answer

    Correct Answer: finds

    Note: This Question is unanswered, help us to find answer for this one

    261. Which of the following statements select(s) all option elements that are selected?


    Answer

    Correct Answer: a and c

    Note: This Question is unanswered, help us to find answer for this one

    262. Which of the following arguments is/are (a) valid argument(s) of fadeIn function?


    Answer

    Correct Answer: a and c

    Note: This Question is unanswered, help us to find answer for this one

    263. The outer height is returned by outerHeight function including ___ and ___ by default.


    Answer

    Correct Answer: border, padding

    Note: This Question is unanswered, help us to find answer for this one

    264. How or Where can we declare a plugin so that the plugin methods are available for our script?


    Answer

    Correct Answer: Before the &lt;/body&gt; tag of the document, include the plugin after main jQuery source file, before our script file.

    Note: This Question is unanswered, help us to find answer for this one

    265. Which of the following statements uses a valid selector?


    Answer

    Correct Answer: a, b and c

    Note: This Question is unanswered, help us to find answer for this one

    266. What is the result of the following code snippet?

    jQuery.unique([1, 2, 2, 3, 3, 1]);


    Answer

    Correct Answer: None of the a

    Note: This Question is unanswered, help us to find answer for this one

    267. Consider the following code snippet:

    $('#div1').html($('#div1').html().replace(/bad/, " "));

    Which of the following is the result of this code snippet?


    Answer

    Correct Answer: Replacing "bad" word in the inner html of div1.

    Note: This Question is unanswered, help us to find answer for this one

    268. Which of the following methods can be used to load data?


    Answer

    Correct Answer: getJSON.
    get.

    Note: This question has more than 1 correct answers

    Note: This Question is unanswered, help us to find answer for this one

    269. Which of the following statements returns all https anchor links?


    Answer

    Correct Answer: $('a[href^=https]');

    Note: This Question is unanswered, help us to find answer for this one

    270. Read the following JavaScript code snippet:

    $('div#id1').bind('click.divClick', function () {alert('A div was clicked');});

    What is divClick in the code snippet?


    Answer

    Correct Answer: A namespace.

    Note: This Question is unanswered, help us to find answer for this one

    271. 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 ___.


    Answer

    Correct Answer: the rows of table1 at order 3n + 1 (n = 0, 1, 2,...) have class firstRowClass

    Note: This Question is unanswered, help us to find answer for this one

    272. The css() function allows you to ___.

    Answer

    Correct Answer: change the inline style attribute of an element.

    Note: This Question is unanswered, help us to find answer for this one

    273. 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?

    Answer

    Correct Answer: 3000

    Note: This Question is unanswered, help us to find answer for this one

    274. The height function returns the height of an element in ___.

    Answer

    Correct Answer: pixel units

    Note: This Question is unanswered, help us to find answer for this one

    275. Consider the following code snippet: Items 1 Items 2 Items 3 Which of the following code snippets return(s) a set of all li tags within id1 except for the li tag with id li2?

    Answer

    Correct Answer: $('#id1 li').not ($('#li2'));

    Note: This Question is unanswered, help us to find answer for this one

    276. What is true of the following code? $('', { src: 'images/little.bear.png', alt: 'Little Bear', title:'I woof in your general direction', click: function(){ alert($(this).attr('title')); } })

    Answer

    Correct Answer: It will alert the value of title attribute of the image being clicked

    Note: This Question is unanswered, help us to find answer for this one

    277. Which is correct syntax for creating new html element?