jQuery primer

  • Oldie but goody
  • Makes you look smart without being a JavaScript expert
  • Relatively straightforward syntax

Examples

Change a button label:

<button id="pay" class="usa-button">Complete payment</button>

$('button#pay').html('Processing…')

Change a button label after clicking it:

<button id="pay" class="usa-button">Complete payment</button>

$('button#pay2').on('click', function(){
    $('button#pay2').html('Processing…');
    $('button#pay2').attr('disabled', true);
});

Back to agenda | Next: Hiding and showing elements in Trap Kit