jQuery onReset Event

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post October 31st, 2009, 9:28 am

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
Strong with this one, the sudo is.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 31st, 2009, 9:28 am

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 17, 2005
  • Posts: 1585
  • Status: Offline

Post November 1st, 2009, 3:04 pm

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
There's no place like 127.0.0.1, badass part is now it's ::1
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post November 1st, 2009, 3:38 pm

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
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 110 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
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.