JQuery Intro
*Click the links of the titles to watch videos on the topics.
Adding jQuery
Include jQuery from a CDN- Explain CDN (Content Delivery Network) and pros/cons
- jQuery from CDN will be used for all exercises.
JQuery Basics:
- Selectors with JQuery
- Using an
element/tag as a selector:
$('element')
- Using an element's
id as a selector:
$('#id-name')
- Using an element's
class as a selector:
$('.class-name')
- Using an
element/tag as a selector:
- DOM Manipulation with jQuery
- text
- get:
$('div').text();
- set:
$('div').text('text string');
- get:
- html
- get:
$('div').html();
- set:
$('div').html('<h1>html string</h1>');
- get:
- append / prepend
- append:
$('div').append('<h1>html string</h1>');
- Inserts content to the end of element.
- prepend:
$('div').prepend('<h1>html string</h1>');
- Inserts content to the beginning of element.
- append:
- text
Supplemental Video