Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Forms

 Forms

A few examples on val, blur, focus, change and submit.

John Nunemaker
PRO

November 17, 2010
Tweet

More Decks by John Nunemaker

Other Decks in Programming

Transcript

  1. jQuery and Forms

    View Slide

  2. .val()
    Gets the input of the first matched element
    http://docs.jquery.com/Attributes/val
    http://teaching.johnnunemaker.com/capp-30550/examples/val-method/

    View Slide

  3. .focus()
    Bind a function to the focus event of each matched
    element. The focus event is fired when an element
    receives focus from the mouse or by pressing tab.
    http://docs.jquery.com/Events/focus#fn
    http://teaching.johnnunemaker.com/capp-30550/examples/focus-a-field/
    http://teaching.johnnunemaker.com/capp-30550/examples/focus-event/

    View Slide

  4. .blur()
    Bind a function to the blur event of each matched
    element. The blur event fires when an element loses
    focus either via the mouse or by pressing tab.
    http://docs.jquery.com/Events/blur#fn
    http://teaching.johnnunemaker.com/capp-30550/examples/blur-event/
    http://teaching.johnnunemaker.com/capp-30550/examples/blur-validation/

    View Slide

  5. .change()
    Binds a function to the change event of each matched element.
    The change event fires when a control loses the input focus
    and its value has been modified since gaining focus.
    http://docs.jquery.com/Events/change#fn
    http://teaching.johnnunemaker.com/capp-30550/examples/change-event/

    View Slide

  6. .submit()
    Bind an event to the submit
    event of each matched element.
    http://docs.jquery.com/Events/submit#fn
    http://teaching.johnnunemaker.com/capp-30550/examples/submit-event/

    View Slide

  7. Assignment 12
    http://teaching.johnnunemaker.com/capp-30550/sessions/jquery-forms/

    View Slide