JS Essential Training Chapter 11: Item C - Introduction to jQuery
In JavaScript the last load statement is the one used but in jQuery it will use all instances of the 'ready function.(true/false)
true
You can do the same things as in JavaScript but with less code.(true/false)
true
Show an example of using a jQuery selector called "h2" to call a function that contains a jQuery statement to put the text "You clicked me." in the h2 tag.
$("h2").click(function() { $(this).text("You clicked me!"); });
Example of the jQuery Alias:
$("what to fine").someAction(any params);
Show an example of the ready function
$(document.ready( function () { $("#pageID").text("The DOM is fully loaded."); })
jQuery methods to add, remove, and toggle classes are:
.addClass("highlight"); .removeClass("highlight"); .toggleClass("highlight");
What is the jQuery Alias?
replace jQuery with the $ sign.
Three examples of get by element type:
JQuery("p") jQuery("a") jQuery("li")
What is the difference between using JavaScript '.className = "highlight" ' and jQuery '.addClass("highlight")
JavaScript replaces all classes with the one class "highlight" and jQuery will just add the class "highlight" to the existing classes.
Load the jquery library before/after your code that uses jquery functions.
before
Four selector keywords are?
before after last contains
What is the URL to download jQuery?
http://jquery.com
Simple use of jQuery is to load an element for the HTML and add a class from the CSS file. For example: JavaScript document.getElementById("myDiv").addClass("highlight"); Use jQuery to do the above JavaScript.
jQuery("#myDiv").addClass("highlight");
How do you use 'last' select the last list element in multiple list item tags;
jQuery("li:last").addClass("highlight");
Example of get by element and class:
jQuery("p.aClass")
Use a selector with the keyword 'contains' to find text inside a paragraph
jQuery("p:contains('package')").addClass("highlight");
Example of get element by class:
jQuery(.someClass).addClass("highlight");
What is the difference between the development version and the production version?
production version is minified,