jQuery onReset Event

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

I couldn't find any references to jQuery supporting the onreset event, I don't even know if the event is something all major browsers support because I've never had a need for it until now.

I decided to skip it and attach my onreset event handler to the reset button in my form instead since the clicking of that reset button is what triggers the onreset event anyways.

JAVASCRIPT Code: [ Select ]
$('#form_id input[type="reset"]').click(function(){
   // stuff to do
});
  1. $('#form_id input[type="reset"]').click(function(){
  2.    // stuff to do
  3. });


Hopefully this will save someone else some time. :D
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

Wow, I forgot that "onreset" even existed, although it is clearly defined here: http://www.w3.org/TR/html4/interact/scr ... l#h-18.2.3
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

It comes in handy.

I have a form that displays an effective file path using a pre-defined value and whatever a user enters into a text box. Because I'm using a <span> with an id to display the effective path, that span isn't reset when the reset button is pressed, unless I watch for and react to the onreset event or the clicking of the reset button. :D

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 62 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.