• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/73

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

73 Cards in this Set

  • Front
  • Back
explain how to fetch the src attribute from an image tag with id 'myImage'
$('img#myImage').attr('src')
explain the purpose of the attr() method
retrieves attributes from DOM elements or sets them if two parms are provided
explain the primary difference between attr() and the getAttribute()/setAttribute() methods
attr() provides access to some special normalized properties that help deal with browser specifics, like cellspacing, class, colspan, etc
what DOM attribute corresponds to the normalized attr() key 'cellspacing'?
cellSpacing
what DOM attribute corresponds to the normalized attr() key 'class'
class (IE) or className
what DOM attribute corresponds to the normalized attr() key 'colspan'?
colSpan
what DOM attribute corresponds to the normalized attr() key 'cssFloat'?
styleFloat (IE) or cssFloat
what DOM attribute corresponds to the normalized attr() key 'float'
(same as cssFloat) styleFloat (IE) or cssFloat
what DOM attribute corresponds to the normalized attr() key 'for'
htmlFor
what DOM attribute corresponds to the normalized attr() key 'frameborder'
frameBorder
what DOM attribute corresponds to the normalized attr() key 'maxlength'
maxLength
what DOM attribute corresponds to the normalized attr() key 'readonly'
readOnly
what DOM attribute corresponds to the normalized attr() key 'rowspan'
rowSpan
what DOM attribute corresponds to the normalized attr() key 'styleFloat'
(same as float) styleFloat (IE) or cssFloat
what DOM attribute corresponds to the normalized attr() key 'tabindex'
tabIndex
what DOM attribute corresponds to the normalized attr() key 'usemap'
useMap
explain how to set an attribute value on a dom element
attr(name, value)
explain what attr(Object) does
sets several parms at once on all dom elements in the wrapped set, where Object contains the name/value pairs to be set
what restrictions does IE place on setting dom attributes?
The name and type of input elements cannot be changed, the value of file and password fields cannot be changed
How can the name or type of an input field be changed in IE?
replace the dom element with a new one containing the corrected name or type
explain removeAttr(name)
removes attribute name from the dom element, some properties like "readOnly" are only set to false when the corresponding attribute is removed
how can the "disabled" attribute be set on a dom element to cause the element to become enabled?
set it to false or remove the attribute using removeAttr()
what does the following call do?

$(...).attr("disabled", "false");
this would actually disable the element, setting the disabled property to any string will disable it, even the string "enabled" - use boolean false or removeAttr() instead
what method allows custom data to be stored directly on DOM elements, instead of relying on global variables?
data(name,value)
explain the arguments for data(name,value)
name - (String) name of value to be stored

value - (Object|Function) if a function, it is invoked and the return value is stored
explain the result of data(name)
returns the custom value stored with name on the first element of the wrapped set provided
what method removes custom data stored directly on dom elements, in lieu of global variables?
removeData(name)
what must be done to remove custom data from elements that are removed from the dom?
nothing, jQuery does this automagically
what method adds a css class to all elements in a wrapped set?
addClass(names)
explain the possible values for names in addClass(names)
a space-delimited string or a function that returns a space-delimited string
explain how to remove a css class from a list of wrapped elements
removeClass(String|Function)

if a function is provided, it must return a space-delimited string
Explain how to easily add or remove a css class, based on whether it already exists on the element
toggleClass(String|Function)
explain the purpose of toggleClass(name, boolean)
if boolean is true, class is added, otherwise it is removed
what is returned by hasClass(String)
returns true if ANY element in the wrapped set contains the class name provided
which is more efficient internally:

a) $('tag:first').is(".className")
b) $('tag:first').hasClass('className')
b - hasClass is more efficient than is() because it only checks CSS and does not need to parse a selector
explain css(name,value)
sets the value of a CSS property 'name' to value on each element of wrapped set
explain the possible types of value in css(name,value)
can be a string, number, or function, if a function it is invoked for each element and the return value used
explain the use of css(Object)
Object is a list of keys/values and each is assigned as a CSSproperty to the elements of the wrapped set
explain the return value for $(...).css('color')
returns the CSS color property for the first element in the wrapped set
explain jQuery shortcut methods for setting CSS width and height
width(value) or height(value) where value is a number in pixels or a string specifying p, em, or %

A function can be used and the return value is set to width/height
when dealing with window and document elements, should width/height, innerHeight/innerWidth, or outerHeight/outerWidth be used?
width/height should be preferred
explain the return value of innerHeight() and innerWidth()
returns the value for the first matched element, which excludes the border but includes padding
explain the return value of outerWidth()/outerHeight()
returns the value for the first matched element, which includes border and padding, and by default it includes the margin

the margin can be excluded with optional parameter set to false
explain the return value of the offset() method
returns values for first matched element

an object containing left and top properties as floats

represents element's position relative to document origin
explain the return value of the position() method
returns values for first matched element

an object containing left and top properties as floats

represents element's position relative to the closest offset parent
explain how to fetch the horizontal and vertical scroll offset of an element
scrollLeft() and scrollTop()
explain how to set the horizontal and vertical scroll offset of a wrapped set
scrollLeft(value) and scrollTop(value)
explain the return value of html()
returns the html content as a string from the first matched element - identical to accessing innerHTML
explain the purpose and arguments for html(content)
sets content as innerHTML of the wrapped set

content - (String|Function)

returns the wrapped set
explain the return value of text()
collects all text from all elements of the wrapped set and concatenates them
explain the text(String|Function) method
sets the text content of all elements in the wrapped set, any <, >, or & symbols are escaped
explain the purpose of and possible data types that can be passed to append(content)
appends html to the end of all matched elements

content - (String|Element|Function|jQuery)

returns the wrapped set
explain how to add html to the beginning of an element's content
prepend(content)
explain the purpose of before(content)
inserts content before (as a prior sibling to) each wrapped element in the set

the elements in wrapped set MUST exist in the DOM
explain the purpose of after(content)
inserts content after (as the next sibling to) each wrapped element in the set

the elements in wrapped set MUST exist in the DOM
explain appendTo(String|Element)
adds all elements in the wrapped set to the end of the content of the target.

String - a selector
Element - the element wrapped set is appended onto
explain prependTo(String|Element)
adds elements in wrapped set to beginning of content

String - a selector
Element - the element wrapped set is prepended onto
explain insertBefore(String|Element)
Inserts all elements in wrapped set before (as prior siblings to) the target provided

String - a selector
Element - the element wrapped set is appended onto
explain insertAfter(String|Element)
Inserts all elements in wrapped set as siblings (after) the target provided

String - a selector
Element - the element wrapped set is appended onto
explain wrap(String|Element)
individually wraps each element in matched set with the passed html tags or a clone of the passed element

String - html fragment
Element - the element to clone
explain wrapAll(String|Element)
wraps all elements in the wrapped set with the passed (String)html or a clone of the Element
explain wrapInner(String|Element)
wraps the CONTENTS of all elements in the wrapped set with the html fragment(String) or clone of the Element provided
explain unwrap()
removes the parent element of the wrapped elements, the child element along with any siblings replaces the parent in the DOM
explain remove(selector)
removes all elements in the wrapped set from the DOM

selector is optional and can further restrict which ones are removed

the elements removed remain in the wrapped set
what happens to bound events when remove() is called on a wrapped set?
the events are removed
what happens to bound events when detach() is called on a wrapped set?
the events are preserved
explain detach(selector)
removes elements from the DOM but retains the bound events attached to them

selector is optional and can further restrict which ones are removed

the elements removed remain in the wrapped set
explain empty()
removes contents (innerHTML) of all DOM elements in the matched set
explain clone(boolean)
Creates copies of the elements in the wrapped set.

If boolean is true, event handlers are copied-defaults to false
explain replaceWith(content)
removes the DOM element and inserts content (String|Element|Function) in its place
explain replaceAll(selector)
replaces all elements matched by the passed selector with the elements in the wrapped set
explain the return value of the val() method
returns the value attribute of the first element in the wrapped set, if a multi-select, an array of selections is returned
explain the purpose of val(value)
sets the value(String|Function) attribute of all elements in the wrapped set