jQuery in Action

  • Here are some examples of things you can do with jQuery

  • This is not a exhaustive list (not possible)


Select Elements using CSS Selectors

JS Bin on jsbin.com


Getting and Setting Content using jQuery

Using methods like .html(), .text() and .val() you can get (i.e. retrieve) and set content on your pages

  // get the text content stored in an element
  $('p.intro').text();

  // set the content to another value
  $('p.intro').text('Updated text that will replace existing content');

JS Bin on jsbin.com

JS Bin on jsbin.com


Adding New Content using jQuery .prepend() / .append()

Using methods like .prepend() and .append() you can dynamically add elements to html to your pages

JS Bin on jsbin.com


More Examples

  • See examples in js_examples (in the starter_code) folder for more examples