0% found this document useful (0 votes)
15 views

Jquery Philosophy

The document discusses jQuery philosophy and methods. jQuery code selects elements using CSS selectors wrapped in $() and performs actions on those elements. Selectors can target elements by id, class, tag name, and attributes. jQuery has methods for DOM manipulation, attributes, events, effects, and AJAX.

Uploaded by

FrancesHsieh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Jquery Philosophy

The document discusses jQuery philosophy and methods. jQuery code selects elements using CSS selectors wrapped in $() and performs actions on those elements. Selectors can target elements by id, class, tag name, and attributes. jQuery has methods for DOM manipulation, attributes, events, effects, and AJAX.

Uploaded by

FrancesHsieh
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

jQuery philosophy

$(div).addClass(xyz); $(div.group-panel).addClass(xyz).find(span:first-child).text(rocks).show(); $(body).click( function() { $(div).addClass(xyz)} ); $(body).live( click, function() { $(div).addClass(xyz)} );

jQuery code begins $ followed by a selector and ends with actions(s). Selectors and actions can be attached to events.

$ - a jQuery Object $( ) - jQuery wrapper (single/double quotes) $(div) - Find Some Elements addClass(xyz) - Do something with them

Selecting using selectors - Just pass a selector to $() - Use any CSS selector Selecting By Id $(#header)

Selecting By Class $(.updated)

Selecting by tag name $(table)

Combine them $(table.user-list) $(#footer ul.menu li)

Using filters for selecting: Basic Filters Forms :input, :text, :submit, :password, .. :enabled, :disabled, :checked, .. :first, :last, :even, :odd, ... Content Filters: :empty , :contains(text), :has(selector), .. Attribute Filters: [attribute], [attribute=value], [attribute!=value], ..

jQuery Methods: DOM Manipulation before(), after(), append(), appendTo(), ..

Attributes

css(), addClass(), attr(), html(), val(), .. Events click(), bind(), unbind(), live(), .. Effects hide(), fadeOut(), toggle(), animate(), .. Ajax load(), get(), ajax(), getJSON(), ..

You might also like