Elance jQuery Test Answers 2015



How is jQuery licensed?
Open source
Private
Secret
Proprietary


var result = $("#div").css("color","red") What does the "result" var contain?
jQuery object
False
True
CSS property


Which custom selector is case sensitive?
:case()
medium
:contains()
:includes()
:custom()


What does the empty() function do?
Removes all child nodes of the set of matched elements from the DOM
Clears the text in a node
Checks if a node is empty
Removes all child nodes of the set of matched elements from the DOM including the parent node


What element type can you apply the "jQuery.unique(...)" on?
Arrays of strings
Arrays of numbers
Arrays of DOM elements
Arrays of characters


Which of the following jQuery functions are deprecated?
.live()
.browser()
.die()
.sub()
All of these


When an event is triggered on an element, the same event is also triggered on all of that element’s ancestors. What is the name of this process?
global event
medium
event bubbling
progressive enhancement
upward progress


The insertAfter function adds a new element as a sibling. What comparable function adds a new element as a child?
appendTo
addChild
createChild
insertNew
expandFamily


Which function locates elements at the same level as the current selection?
.children()
.find()
.siblings()
.closest()


What is the difference between remove() & empty()
remove() method removes the selected element(s) and its child elements whereas empty() method removes the child elements of the selected element(s)
they are same
remove() method removes the child elements of the selected element(s) whereas empty() method removes the selected element(s) and its child elements


Why do we add the stop() function before the animate() function?
to stop the animation after it has finished.
stop() ends any currently running animations on the element.
stop() halts the execution of the scripts on the page until any animations have finished.
to tell jQuery that the animation has to be stopped at some point.


What does $("div#intro .head") select?
The first element with id="head" inside any div element with class="intro"
All elements with class="head" inside the first div element with id="intro"
All div elements with id="intro" or class="head"


True or false? The jQuery library can be used to request a server-side script.
True
False


What does the greater sign (>) indicate in the following code? $('#summary > div').hide();
chaining
hierarchical relationship
directional indicator
child selector
comparison operator


The selector :disabled will perform the following:
Select only elements in a disabled state
None of the above
Disable any elements currently set to an enabled state
Create a new element with the state set to disabled


Which of the following statement returns all anchor links that start with "https"?
$('a[href] = "https"');
$('a[href="https"]');
$('a[href^="https"]');
$('a[href$="https"]');


Which part of the following statement is the action? $('p').css('color','blue');
$('p')
'color'
'blue'
.css


You can copy an element by calling which of the following methods?
clone()
cloneTo()
moveTo()
copy()


What jQuery function is used to set an element's markup content?
document.write()
.html()
echo()
.content()


What is the equivalent of the following code? $('div').click(function {alert(1);});
$('div').handler('click',function {alert(1);});
$('div').bind('click',function {alert(1);});
$('div').event('click',function {alert(1);});
$('div').call('click',function {alert(1);});


Which of the following is used to schedule a function to execute after an animation has completed?
progressive enhancement
callback function
graceful degradation
chaining
AJAX


If you want to change the text displayed in a paragraph by adding text before what's currently displayed, which would be correct?
$('p').prepend('text to add');
$('p').text('text to add');
$('p').html('text to add');
$('p').content('text to add');
$('p').append('text to add');


What does the following code do? $('#mydiv').wrap('<div/>');
duplicate the element id 'mydiv'
Create a div next to the element id 'mydiv'
Create a parent 'div' tag for element id 'mydiv'.


How do you pass options to a plugin?
$("...").foobar( option1: 123, option2: 9 );
$("...").foobar({ option1: 123, option2: 9 });
$("...").foobar([ option1: 123, option2: 9 ]);


True or False : It is possible to use relative values for jQuery animate() method.
False
True


What is the END STATE STYLE of the paragraph element in the code $('p').hide(); ?
opacity: 0;
display: none;
height: 0;
visibility: hidden;


What method is used to set one or more style properties for selected elements?
javascript()
html()
style()
css()


How do you clear the contents of this paragraph element? <div id='file'><p>content goes here</p></div>
$("#p").empty()
$('#file p').empty();
$("file").clear();
$("#file").clear();
$(".file").empty();


How would you prevent the default browser action from an event handler without affecting other properties of the event flow?
$a.click(false);
$a.click(function () { /* code */ return false; });
$a.click(function (e) { /* code */ e.returnValue = false; });
$a.click(function (e) { /* code */ e.preventDefault(); });


Which is a state selector?
$('.name')
$('#name')
$(':name')


Which is an example of chaining a jQuery command?
$("#box").fadeOut().fadeIn();
$(#box).fadeOut().fadeIn()
$(<#box>).fadeOut().fadeIn();
$(“box”).fadeOut().fadeIn()


What can be used to append a new paragraph element into a div with id 'mydiv'?
$("div#mydiv").never("<p>Paragraph</p>");
$("div#mydiv").before("<p>Paragraph</p>");
$("<p>Paragraph</p>").appendTo("div#mydiv");
$("<p>Paragraph</p>").new("div#mydiv");


The "hide()" function set which of the following properties?
The "width" property
The "height" property
The "visibility" property
The "display" property


True or False? live() method has been removed from version 1.9
False
True


What method is the primary means of attaching a handler to an event?
.attach()
.on()
.link()
.behavior()


Which of the following is NOT a valid example of a selector filter?
tr:even
div:left
tr:odd
p:first
li:last


What does every selector expression return?
recordset
HTML text
jQuery object
result set


Where does jQuery code run?
client browser
host server
client server
host browser


$.foo() is equivalent to:
None of them
javascript.foo()
jQuery.foo()
document.foo()


How do you schedule a Javascript function to execute as soon as the document has been interpreted by the browser?
.hide()
.show()
.load()
.ready()


True or False : jQuery method fadeTo() permits fading to a given opacity.
True
False


How do you change the CSS property 'color' of an element?
$("#someID").css("color:red");
$("#someID").css("color","red");
$("#someID"))((.style("color","red");
$.css("color:red");


What method is used to switch between adding/removing one or more classes (for CSS) from selected elements?
switch()
toggleClass()
switchClass()
classSwitch()


What keyword would you use to refer to the object on which the currently executing method has been invoked?
object
here
medium
that
this


Which function is used to make a copy of a selected element?
.copy()
.duplicate()
.clone()
.repeat()


How do you delete an element with an id of "dialog" from the DOM using jQuery?
$(".dialog").remove();
$("#dialog").delete();
$.remove("#dialog");
$.delete(#dialog);
$("#dialog").remove();


Which is a syntactically valid jQuery command?
jQuery("book").fadeOut{}
$("book").fadeOut{}
$(#book).fadeOut();
$("#book").fadeOut();


Which of the following is the correct command to fade in an element over a three-second time period?
fadeIn(3000)
fadeIn('3 seconds')
fadeIn('three')
fadeIn('3 sec')
fadeIn(3)


Illustrate selecting a HTML element using its class:
$("#myClass")
$('#myClass')
$(".myClass")
#(".myClass")


Which of the following is valid?
$('p').css('color: red;');
$('p').css('color: red');
$('p').css('color', 'red');


Which command selects an element using its ID?
$("#myID")
#{".myID"}
${."myID"}
${"#myID"}


How would you hide the following element ? <input id="id_txt" name="txt" type="text" value="" />
$("text").hide();
$(#id_txt).remove();
$("#id_txt").hide();
$("id_txt").hide();
$("#id_txt").remove();


Which selector matches all elements?
#
*
&
?


Which method is used to prevent the default action of an event?
event.preventAction()
event.stopDefault()
event.stopData()
event.preventDefault()


What is '$();' equivalent to?
Function();
jQuery();
operator();
java();
function();


Which sign does jQuery use as a shortcut for jQuery?
the > sign
the $ sign
the # sign
the . sign


What does the jQuery attr() function do?
Takes the name of an attribute on the page and makes it animate.
Takes the name of an attribute on your page and gives the value of that attribute.
Takes the name of an attribute and duplicates it.
Takes the element and duplicates it.


Which method is used to hide selected elements?
hidden()
display(none)
hide()
hide(display)


Which is a class selector?
$('_name')
$('.name')
$('#name')


What does this script do? $(function() { $( "#effect" ).animate({ backgroundColor: "#fff" }, 1000 ); });
Changes the background color of the element with id 'effect' to #fff within 1 second.
Changes the background color of the element with class 'effect' to #fff within 1 second.


$() is an alias of the jQuery() function
False
True


What is the difference between .width() and .outerWidth()?
Only difference is .width() returns a number & outerWidth() returns a string.
width() returns the computed width of the element while outerWidth() returns the width plus all the margins and paddings.
No difference. width() is a shorthand alias for outerWidth()


Which is NOT a jQuery method?
toggle()
fadeIn()
show()
alias()


Is jQuery a library for client scripting or server scripting?
Server Scripting
Client Scripting


Illustrate the code needed to include the jQuery library in an HTML file:
<script src="jQuery.js"></script>
$(script) src="jQuery.js")
$script src="jQuery.js"
$(script src)="jQuery.js"(/script)


The '#' symbol indicates a lookup on what?
element
Name
element's ID
Attribute


What do selectors do?
Allows selection of libraries.
Allows the content to be stopped at some point.
Allows you to select an array in the node list.
Allows you to select HTML elements (or groups of elements) by element name, attribute name or by content.


Which is an id selector?
$('.name')
$('#name')
$(':name')


jQuery uses CSS selectors to select elements?
False
True


How do you test if an element has a specific class?
use .getClass()
use .isClass()
use.class()
use .hasThis()
use .hasClass()


Is it possible to use jQuery with AJAX?
No
It is code dependent
Yes


What language is jQuery constructed in?
JavaScript
C++
Java
PHP


What function can be used to alternate an element's state between display and hidden?
alternate
toggle
switch
flip
reverse


Which of the following is correct?
jQuery is a JavaScript Library
jQuery is a python Library
All of these
jQuery is a JSON Library


Which of the following is correct?
jQuery is a JavaScript Library
jQuery is a JSON Library
None of these


What language is jQuery written in?
PHP
CSS
JavaScript
Java


What is the proper way to show an element?
$('#foo').showElement();
$('#foo').style('show');
$('#foo').show();
$('#foo').display('show');


What is the difference between searching 'find()' and 'children()'
Both do similar tasks
There is no find() function
There is no children() function
The .find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.


What is jQuery used for?
Rapid web development
Overcome cross-browser issues
All of these
Simplify JavaScript coding


Which of the following methods can be used to remove the title of an img element?
$("img").remove("title")
$("img").deleteTitle()
$("img").removeAttr("title")
$("img").removeTitle()


True or false: it is possible to use jQuery together with AJAX?
True
False


jQuery.trim() function is used to ?
Remove Whitespace from beginning of string
Remove Whitespace from beginning & ending of string
trim() is not a valid Jquery function
Remove Whitespace from end of string


With jQuery, look at the following selector: $("div.intro"). What does it select?
The first div element with id="intro"
All div elements with class="intro"
The first div element with class="intro"
All div elements with id="intro"


Which method stops an event before the default action is triggered?
medium
.stopDefault()
.preventDefault()
.stopEvent()
.end()


Which function does jQuery provide to remove whitespace from the beginning and end of a string?
$.strip( )
jQuery does not provide such function.
$.trim( )
$.stripspace( )


Is it possible to use jQuery together with AJAX?
Yes
No


code for making all div elements 100 pixels high?
$("div").height.pos=100
$("div").height=("100")
$("div").height="100"
$("div").height(100)


What does $("div.intro") select?
The first div element with class="intro"
The first div element with id="intro"
All div elements with class="intro"
All div elements with id="intro"


Which of the following statements will display an alert dialog when the button with id "myBtn" is clicked on?
$("#myBtn").click( function() { alert("hello"); } );
$var handler = $function() { alert("Hello"); }; $("#myBtn").click( handler() );
$("#myBtn").click( alert("hello") );
$("#myBtn").click( alert(event) );


Which of the following does jQuery NOT integrate seamlessly with?
HTML
Java
CSS
DOM


Is this a valid statement in jQuery? $("#foo").hide().show().css("color", "red").fadeOut();
Yes
No


Which of the following statement best described the following code snippet: $('#myID').animate({width:"90%"}, "fast");
Animate the tag with myID from 90% width to 100% width.
Animate the tag with myID from 90% width to the current width.
Animate the tag with myID from 90% width to 0% width.
Animate the tag with myID from the current width to 90% width.


To dynamically set the src attribute of all img elements use:
$('img').attr('src', 'photo.jpg');
$('img').attr('src').set('photo.jpg');
$('img src').set('photo.jpg');
$(img).setAttribute('src', 'photo.jpg');


In the following statement, which is the selector? $('p').css('color','blue');
color
.css
p
blue


How do you fetch the first span on the page which has the class 'white'?
$('span; white: first')
$('first.span.white')
$('white;span;first')
$('span.white:first')


When using jQuery animation, you can specify duration in the following format:
500
All of these
'fast'
Leave it blank


Which of the following selectors is the fastest?
$('div');
$('#container');
$('.grid12');
$('div+.grid12');
$('#container+div');


Which jQuery function is used to prevent code from running, before the document is finished loading?
$(window).load()
$(document).ready()
$(document).load()
$(body).onload()


What character is used to identify a child combinator relationship?
plus (+)
medium
left carat (<)
right carat (>)
minus (-)


Which jQuery method is used to perform an asynchronous HTTP request?
jQuery.syncAjax
jQuery.asyncAjax()
jQuery.ajaxSetup()
jQuery.ajax()


What jQuery function is used to add HTML content just outside of a selection?
outside()
after()
more()
later()


What does the animate method do?
Allows you to create a cartoon using the DOM
Allows you to animate any CSS property controlled by an alphabetic value
Allows you to animate CSS property controlled by a numeric value


What is the correct way to check if an element has a specific class?
hasClass("foo", "bar");
$("#foo").hasClass(".bar");
$("#foo").hasClass("bar");
$("#foo").class('bar');


Which of the following is a subset of jQuery's CSS selectors?
attribute selectors
css3 selectors
universal selectors
All of these choices are subsets
child selectors


The following code is an example of ______: $('.tooltip').hide().fadeIn(9000).delay(1000).fade0ut(9000);
it ends a statement
statement
an effect that disables
Chaining


Which method is used to bind an event handler to existing and future matching elements?
attach();
click();
.on();


How should your JQuery code be wrapped so it executes only once the page has loaded?
$(document).ready(function () { /* Code goes here */ });
$(document).ready({ /* Code goes here */ });
$(document).ready(function { /* Code goes here */ });
document.ready(function () { /* Code goes here */ });
$(document).pageloadcomplete(function () { /* Code goes here */ });


What does the $.get() jQuery function do?
It fires a GET OBJECT request
It returns an object
It returns the DOM elements that are contained in the jQuery object.
It fires a GET AJAX request


Which selector will only return one element?
:one-based()
:nth-child()
:even
:odd


What method returns control of the $ identifier to other libraries?
.$()
.library()
medium
.noConflict()
.return()


Which term is given to the jQuery feature that allows the attachment of one function to another?
chaining
stringing
concatenation
outer join


What is the output of the following: $.each([1,2,3], function(){ document.write(this + 1); });
1231
"234"
undefined
223


What keyword can be used to refer to the element that triggered the event (in the event handler callback)?
this
that
e
event
element


What does $('#myDiv').load('page.html') do?
it loads the #myDiv on the contents of the 'page.html' browser
It adds the string 'page.html' as the contents of the #myDiv div.
it fires an AJAX request, fetches the result of page.html as text, and inserts it into the div


What is not a an AjaxEvent.
.ajaxRun()
.ajaxComplete()
.ajaxSend()
.ajaxError()
.ajaxStop()


Which jQuery method can be used to bind both the mouseover and the mouseout events?
toggle()
hover()
mouse()
change()
switch()


What does the following code do: $('#myDiv').trigger('click');
It makes a click on any element and creates a trigger.
It simulates a click on the element and runs all the event handlers associated with it.
When a click occurs the trigger is going to be activated.
It sets up a trigger. When a click occurs, the trigger is going to be activated.


What method checks for the presence of a class before applying or removing it?
.apply_remove()
medium
.checkPresence()
.toggleClass()
.checkFunction()


$(function(){ //executable code }); The executable code will be run:
after the DOM has loaded, but prior to anything else loading
after everything except other scripts are loaded
after all other javascript has been read and executed
before anything has loaded
after everything has loaded


What method selects the sibling element that immediately follows the current one?
next()
sibling()
medium
next_element()
next_sibling()


What term refers to the acceleration and deceleration that occurs during an animation?
resizing
easing
speeding
velocity
gradient


Given the following HTML code snippet: <div id="wrapper"> <div class="wText">...</div> ...<!-- more wText items here --> <div class="wImg">...</div> ...<!-- more wImg items here --> <div class="wVideo">...</div> ...<!-- more wVideo items here --> </div> How would you get a collection of all the items inside the "wrapper"?
$('#wrapper').find("all");
$('#wrapper').html();
$('#wrapper').contents();
$('#wrapper').children();


How to Remove from the queue all items that have not yet been run in jquery?
dequeue()
hide()
queue()
clearQueue()


What is $(fn); a shortcut for?
$( fn() ); // Shortcut to create or select elements using the string returned by the "fn" function.
$(window).on('load', fn);
$(document).ready(fn);


Which one will be found faster?
$('#element')
$('div#element')
$('.element')
$('div.element')


The "complete" callback in a jQuery AJAX request, is called only after...
the AJAX request is failed
if there is no "success" callback defined in the AJAX request
the AJAX request is successful without any errors
the AJAX request finishes, irrespective of error or success


For best performance in modern browsers, which of the following would you use to select all radio inputs?
$('[input.radio]');
$('.radio');
$('[type="radio"]');
$('[input="radio"]');
$('||radio');


how do you select the content document of an iframe on the same domain jQuery
.find()
.children()
.contents()
.filter()


Which of these is NOT a pseudoclass?
:before
:last
:first
:next
:after


How to set default options for all future AJAX requests?
.ajaxSend()
jQuery.ajax()
.ajaxStart()
jQuery.ajaxSetup( options )


By default, the outerWidth(true) function returns the width of the element including
margin,border and padding
border and padding
margin and padding
margin and border


Which of the following selectors is NOT equivalent to the others?
:nth-child(1)
:first-child
:first


True or False? jQuery UI is part of jQuery.
True
False


What does this code do: $('#id1').animate({width:"250px"}, "slow").animate({height:"250px"}, "fast");
First the height animates, then the width animates.
First the width animates, then the height animates.
Both the width and height animates at the same time.


Which of the following is NOT a custom jQuery form selector?
:selected
:checkbox
:enabled
:form


What does the filter() method do in this: $('div').filter('.nav')
it sifts through all divs and leaves only those contained within a .nav element
The filter funtion is run when the DOM is initialized
it filters all the ('.nav') and leaves only the divs
it sifts through all the divs and leaves only those with the nav class


What does the following code do? $(".foobar").find(".foo").fadeOut();
Fade out of elements matching ".foobar"
Fade out of elements matching ".foo" that are descendants of elements matching ".foobar"
Fade out of all descendants of elements matching ".foo" inside those matching ".foobar"
Fade out of all children of elements matching ".foobar"


How do I pull a native DOM element from a jQuery object?
$("#foo[0]");
$( "#foo" ).get(native[ 0 ]);
$( "#foo" ).get( 0 );
$( "#foo" ).find(native[ 0 ]);


Which of the following will get the CURRENT COORDINATES of the first element in the set of matched elements, RELATIVE TO THE DOCUMENT?
position()
offset()
pos()
coord()


<div id="MyDiv">Two</div> <div id="MyDiv">One</div> <div id="MyDiv">Five</div> Given the above HTML What would the output of the following code be? var myDivText = $('#MyDiv').text() console.log(myDivText)
Five
One
Undefined
Null
Two


$(".clicker").click(function() { $('link[rel=stylesheet]').attr('href' , $(this).attr('rel')); }); The above is used to do what?
Reload the currently selected stylesheet upon clicking the element with class "clicker"
Change the stylesheet loaded in the page upon clicking the element with class "clicker"
Nothing, it returns a console.log error
Adds the contents of another stylesheet to the currently loaded one upon clicking the element with class "clicker"


What method allows us to remove values that were previously set using jQuery.data()?
.clearQueue()
.dequeue()
.removeData()
.data().remove()


Which can be used to detect broken images?
image.elements()
$("img").isBroken()
image.error()
$("img").error(callbackFunction)
$("img").error()


What is the name of a function that intercepts combinations of user actions?
combo function
medium
user generated event
user function
compound event handler


What is the difference between $('#element').remove() and $('#element').detach()
detach() removes the element from the DOM, while remove() only removes jQuery data.
remove() removes the element from the DOM, while detach() only removes jQuery data.
detach() removes the element along with all the jQuery data, whereas remove() only removes it from the DOM.
remove() removes the element from the DOM along with any jQuery data, while detach() only removes the element from the DOM.


How can you get the number of paragraphs in the html document using jQuery?
$('p').count()
$('p').length
count($('p'))
$('p').length()
$('p').count


What index value does the :nth-child() selector starts with?
1
2
0


What does this return: $(".class").attr("id");
The value of the 'id' attribute for all the elements in the set of matched elements
The value of the 'id' attribute for the first element in the set of matched elements
The value of the 'class' attribute for the first element in the set of matched elements
Nothing


What does the serialize() method do: $('#myForm').serialize();
fetches the names and values in all input fields and creates a JSON representation of the form
fetches the names and values in all input fields, and returns them as an object.
fetches the names and values of all the input fields contained in the form, and generates a URL encoded string representation
fetches the code and makes it numeric.


How do you get the value of the selected radio button in a group of radio buttons with the name of 'radioName'?
$('#myForm', 'input[name=radioName]').is('checked').val()
$('input[name=radioName]:first').val()
None of these
$('input[name=radioName]:checked', '#myForm').val()


True or False: .position() accepts an optional argument as a selector
false
true


What will be the value of "display" css property of the following tag? $('span').hide(); $('span').show();
It will vary depending the value of the span's initial display property
block
inherit
inline-block
inline


Which will NOT select the second "li" element?
$( "li:eq( 1 )" )
$( "li:eq( 2 )" )
$( "li:nth-child( 2 )" )


Event delegation:
Does not let you pause or delay the propagation of events
Is a technique that lets you separate event-handling code from other code
Allows you to register handlers before elements are added to the page
Allows you to trigger events on related DOM elements simultaneously


Which is not a type of selector?
Javascript Selector
Custom Selector
XPath Selector
CSS selector


What is an event handler?
A function that occurs during and after the event is executed.
A function that executes your code before the event occurs.
A function that executes your code as the event occurs.
A function that executes your code after the event occurs.


Which jQuery method animates the height of matched elements?
.height()
All of these
.slideToggle()
None of these
.slideHeight()


Which of the following syntaxes are equivalent to $(document).ready(handler)?
.ready()
.load()
All of these
$(handler)


What does this do? $("p").find("span").end().css("border", "2px red solid");
Selects all paragraphs, finds span elements inside these, go to the end of each paragraph, then apply CSS rule.
Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs, then apply CSS rule.
Selects all paragraphs, apply CSS rule, then reverts the selection back to the spans.
Selects all spans, then apply CSS rule.


Which of the following will get the current coordinates (of the first element in the jQuery collection) relative to the offset parent?
relOffset()
relativePosition()
offset()
position()


Attribute Contains Prefix Selector is:
[name+="value"]
[name$="value"]
[name|="value"]
[name~="value"]
[name*="value"]


How can you add your own custom selectors to jQuery?
$.extend($.expression[':'], { name : function } or $.expression[':'].name = function(){}
You can not extend the selector engine, you have to create your own filter
$.extend($.expr[':'], { name : function }); or $.expr[':'].name = function(){}


What selector engine does jQuery use
CssQuery
Bouncer
jSelect
getElementsBySelector
Sizzle


What do you use jQuery.noConflict() for?
to restore the '$' to its previous owner.
to prevent other libraries from stealing the '$' function.
to make jQuery's $ function accessible by other libraries
To only have one javascript library on a page.


What does .delegate() allow you do, that .live() does not?
Override existing event listeners.
Capture events that are fired from parent DOM elements.
Attach the event handler to any DOM element.
Instantiate event listeners before the document is ready.


$("[id|=experience]") will select which ID?
<div id="experience-51">
<div id="experience_51">
<div id="experience51">
<div id="experienceFiftyOne">


What does the ".divClick" code snippet refers to in the following code snippet: $('div#id1').bind('click.divClick', function () {alert('A div was clicked');});
A div class
An event type
A namespace
An event function
A div ID


Which of these is NOT a valid way to initiate the document.ready call?
$(function() { /* Stuff here */ });
(function(x) { x(function() { /* Stuff here */ }); })(jQuery);
jQuery(document).ready(function($) { /* Stuff here */ })(jQuery);
$(document).ready(function() { /* Stuff here */ });


In what scenario will the alert box show? $(function(){ if(!$("p")) alert("hello"); });
When there are p tags on the page
It will never show.
When there are no p tags on the page
When there is more than one p tag on the page


What does the following return? $.inArray("foo", ["foo", "bar"]);
true
0
1
TRUE


True or false: The .blur() function can be bound to a form element to detect when a child element loses focus.
False
True


You can animate 'color' and 'background-color' properties.
True
False


We can delay execution of .css() with .delay()
false
true


which property in the event object can be used to get the key code of a key press event
event.which
event.keyCode
event.type
event.key


Assuming there are p tags on a page, what will be the result of the code below: $(function(){ $("p").hide("slow").show(); });
The opacity of all the p tags will be set to 0
A JavaScript error will occur.
The p tags will be hidden.
The p tags will collapse slowly and then appear.


True or False :jQuery method dequeue() used while creating animation effects removes all remaining queued functions from the selected elements
True
False

2 comments:

  1. Which protocol should you use when referencing a CDN script in a web page?

    +++++Let the browser figure out the protocol by using ++++++++
    Always use https so that it works with secure pages
    None of the above
    Always use http

    ReplyDelete
  2. Which code selects the first article from the news.html page, assuming every article is enclosed in tags.

    $("#target").ajax("/news.html article:get(0)");
    $("#target").load("/news.html article:eq(1)");
    $("#target").ajax("/news.html article:eq(0)");
    $("#target").load("/news.html article:get(1)");
    ++++++$("#target").load("/news.html article:eq(0)");+++++++

    ReplyDelete