Programatically trigger an event w/ JS

  • killercelery
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jul 10, 2003
  • Posts: 13
  • Loc: Montréal, Québec
  • Status: Offline

Post July 23rd, 2003, 7:36 am

Does anyone know if it's possible to trigger an event using JS?

I'm trying to trigger the onChange event of a text field when the code changes the current value contained in the text field. I tought the event might be triggered automatically, but it's not the case.

THX
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post July 23rd, 2003, 7:36 am

  • RichB
  • Guru
  • Guru
  • User avatar
  • Joined: May 17, 2003
  • Posts: 1121
  • Loc: Boston
  • Status: Offline

Post July 23rd, 2003, 9:26 pm

I tried this and it seemed to work for me in IE and NE - it calls the onchange handler of the text field if that's what you want.

Code: [ Select ]
document.theForm.theTextField.onchange()


You can also do this for IE only:

Code: [ Select ]
document.theForm.theTextField.fireEvent("onchange")
Free Programming Resources
  • killercelery
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jul 10, 2003
  • Posts: 13
  • Loc: Montréal, Québec
  • Status: Offline

Post July 24th, 2003, 5:56 am

Thanks, both work great!! :D

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: demonmaestro and 117 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
 
 

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