CIT 171 Chapter 12 Review
Suppose you are using the jQuery library and want to run an anonymous function only after your web page loads completely. Which JavaScript statement should you use?
$( () => { // statements});
To return an array of the botany article's sibling elements that are articles containing ordered lists, you should use the jQuery expression _____.
$("article#botany").siblings("article").has("ol")
Suppose a jQuery event handler runs an animation in response to a mouseenter event for the cuteCube element. When the user moves the mouse away from the cuteCube element, the animation can either be allowed to continue to its conclusion or stopped using the stop() method, leaving the element in whatever state it has reached.
true
The following jQuery UI method can be called on an element that has been selected and hidden in order to reveal that element using a vertical "clip" effect over a 1-second time interval..effect("clip", {mode: "show",}, 1000)
true
When deciding which version of jQuery to use for a web app, a JavaScript developer should consider the security updates provided by the most current release as well as its compatibility with any jQuery plugins that will be used.
true
You view a web page and watch an element expand in size and move upward as you roll over it with your mouse pointer. If this animation was created using the jQuery library, then these effects were achieved by gradually changing the values of several CSS properties for the element.
true
Suppose you are writing a jQuery statement, and your selector chooses an article by its id attribute. Which jQuery method can you call on this selector to return all ancestors of the selected element(s) that are also articles?
$("article#zoology").parents("article")
Which jQuery expression uses the correct syntax and will select the element(s) listed?
$("article.botany p") selects paragraphs nested within article elements of the botany class
Suppose you want to write the text stored in any h1 element clicked by the user to the console. Which jQuery statement(s) should you write to do this?
$("h1").click(e => { console.log($(e.target).text());});
Suppose your web page includes the following HTML fragment:<h1 class="feature">Recipe of the Day</h1><h1 class="feature">Happy Ending of the Day</h1>What jQuery command should you use to enclose these two h1 headings within article elements, creating a new parent node for the headings?
$("h1.feature").wrap("<article></article>")
Which jQuery command do you use to make a hidden h1 element of the class "popping" appear gradually over 1 second?
$("h1.popping").show(1000);
Suppose you want to retrieve the width of the last inline image of the holidays class. Which jQuery expression should you use to do this?
$("img.holidays").last().attr("width")
Suppose your web page includes a form with a favoritefood input box and you want to set the value stored in this input box to "Chocolate" using jQuery. Which expression should you use to do this?
$("input#favoritefood").val("Chocolate")
Suppose you are writing a web app and want to use the jQuery library. How can you enable access to jQuery through a Content Delivery Network (CDN)?
Insert a script element provided by the CDN into the HTML source code for your app.
Suppose you are using a jQuery animation to make an element change color when the user clicks on it, and you also want to execute a function as soon as the animation finishes running. How can you do this?
Pass the function in as the final argument to the animate() method called on the element.
Which statement about defining CSS properties using jQuery is correct?
You can set the values of multiple CSS properties for the selected element(s) by passing them to the css() method in JSON format.
All jQuery commands begin with _____.
a $ symbol followed by a reference to a selection of elements from the web page document or to the document as a whole in parentheses
Which JavaScript code using the jQuery library should be placed in the blank to make the boldbright heading appear and then grow larger and more opaque over a period of 0.8 seconds when the command is executed?$("h1.boldbright").css({fontSize: 0,width: 0,opacity: 0})_____
animate({ fontSize: "2.5em", width: "1000px", opacity: 1}, 800);
To define an attribute for an element using jQuery, you can _____.
call the attr() method on its selector and pass in the attribute name and value as arguments
When using the jQuery library to build a web app, you should _____.
download the library to your website as a .js file if your app needs to work offline
A web page developed using jQuery includes riddles and their solutions, paragraph elements of the "solution" class that are hidden when the page loads. You want to display the solutions when the user clicks on the "reveal" image element. The following code to display them is correctly written.$("img#reveal").click ( () => {$("p.solution").hide();})
false
Janice has just been discussing the jQuery UI library with a colleague and feels certain it would benefit her current web app projects. Janice's next step should be to edit the HTML and CSS code for her website to load the required files for the plugin.
false
Which jQuery build excludes the AJAX features and some animation tools that have been supplanted by Fetch and CSS since the library was developed?
slim
Suppose a web page includes a div element with the id description that contains some text describing a vacation package. The following JavaScript code using the jQuery library increases the opacity of this div element, then adds some text to the existing content of the div element, making it appear gradually.$("div#description").fadeOut(1000, () => {$("div#description").text("Adventure awaits!");.fadeIn(1000);
false
When writing jQuery code to handle an event, you can access the currentTarget property of the event object to return the DOM element that triggered the event or access the target property of the event object to return the current element experiencing the event during the bubbling phase.
false
Suppose you are writing a jQuery command that will display heading elements of the switch class if they are hidden or hide them if they are visible. What should you place in the blank in the following code?$("h1.switch").animate({_____}, 500);
fontSize: "toggle", opacity: "toggle"
Which version of jQuery is less readable but faster to execute compared to its alternative?
minified