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

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

    B
    $('#mySelect').html('<option value="whatever">text</option>').val('whatever')

    C
    ('#mySelect').text('<option value="whatever">text</option>').val('whatever')

    D
    $('#mySelect').val('whatever')

    Note: Not available
    1. Report
  2. Question: How can the href for a hyperlink be changed using jQuery?

    A
    $("a").link("http://www.google.com/");

    B
    $("a").change("href","http://www.google.com/");

    C
    $("a").link("href","http://www.google.com/");

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

    Note: Not available
    1. Report
  3. Question: The position function gets the _____ positions of an element that are relative to its offset parent.

    A
    top and left

    B
    top and right

    C
    bottom and left

    D
    bottom and right

    Note: Not available
    1. Report
  4. Question: 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'));?

    A
    $('#li2').siblings();

    B
    $('#id2').siblings('#li2');

    C
    $('#li2').children();

    D
    $('#id2').children('#li2');

    Note: Not available
    1. Report
  5. Question: Which of the following is the correct way to debug JavaScript/jQuery event bindings with Firebug or a similar tool?

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

    B
    $.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, '\n' + i + ': [' + name + '] : ' + handler ); }); } }); }); };

    C
    var clickEvents = $('#foo').data("events").click; jQuery.each(clickEvents, function(key, value) { event.console.log(value); })

    D
    $.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, '\n' + i + ': [' + name + '] : ' + handler ); }); } }); }); };

    Note: Not available
    1. Report
  6. Question: Which of the following events can be used to disable right click contextual menu?

    A
    contextmenu

    B
    contextualmenu

    C
    rightclickmenu

    D
    The right-click contextual menu cannot be disabled.

    Note: Not available
    1. Report
  7. Question: Which of the following gets the href attribute of "id1"?

    A
    $('#id1).attr('href');

    B
    $('#id1').getAttribute('href');

    C
    $('#id1)[0].attr('href');

    D
    All

    Note: Not available
    1. Report
  8. Question: Which of the following is the correct way to manage a redirect request after a jQuery Ajax call?

    A
    $.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); } } });

    B
    public ActionResult Index(){ if (!HttpContext.User.Identity.IsAuthenticated) { HttpContext.Response.AddHeader("REQUIRES_AUTH","1"); } return View() }

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

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

    Note: Not available
    1. Report
  9. Question: Which of the following is the correct way to change the image source during click event of a button in jQuery?

    A
    $("#button").click(function(){ $(“img”).src(); });

    B
    $("#button").click(function(){$(“img”).attr(); });

    C
    $("#button").submit(function(){$(“img”).text();});

    D
    $("#button").submit(function(){$(“img”).html(); });

    Note: Not available
    1. Report
  10. Question: What is the purpose of $(document).ready() function in JQuery?

    A
    To execute functions after all content and images are loaded

    B
    To execute functions after DOM is loaded

    C
    To execute functions before DOM load

    D
    To execute functions before content and images load

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd