eudaimonious
12/15/2013 - 5:19 PM

On click with document ready and $(this). Other mouse events include: click, dblclick, focusin, focusout, mousedown, mouseup, mousemove, mou

On click with document ready and $(this). Other mouse events include: click, dblclick, focusin, focusout, mousedown, mouseup, mousemove, mouseout, mouseover, mouseleave, mousenter

$('button').on('click', function() {
  
});

// Usually you'll want to wait until the DOM is ready!
// You can also, specify an outer node ('.vacation') 
// within which the clickable node ('button') will be
// found.

$(document).ready(function() {
  $('.vacation').on('click', 'button', function() {
    $(this).remove(); // removes 'button'
  });
});

// Define a function when you'll call it with multiple events
// Do not use parenthesis when calling the function, lest it
// be executed immediately.

function showTicket () {
  $(this).closest('.confirmation').find('.ticket').slideDown();
}

$(document).ready(function() {
  $('.confirmation').on('click', 'button', showTicket);
  $('.confirmation').on('mouseenter', 'h3', showTicket);
});