functions inside a document ready wrapper • Prevents errors that can occur when elements have not yet loaded into the browser • $(document).ready(function() { • //insert function here • }); Wednesday, July 31, 13
‘walking the dom’ a breeze • older methods: • getElementById • getElementsByTagName • advanced ways to select elements • easy to update html content Wednesday, July 31, 13
has been sent.’).addClass(‘success’); • $(‘#modal’).html(‘<p>Oops!Something went wrong. Try again.</ p>’).removeClass().addClass(‘error’); Wednesday, July 31, 13
no child elements, including text • :has(Selector) - contains descendant element • :parent - all parent elements (they have child elements) Wednesday, July 31, 13
required, it already knows its a class • hasClass(‘classname’) • addClass(‘classname’) • removeClass(‘classname’) • toggleClass(‘classname’) Wednesday, July 31, 13