views:

226

answers:

1

For instance if I select a radio button through jQuery code does this fire the onClick event for that particular input?

+2  A: 

No, because that's not a click. You can trigger an event on an element with the trigger method, or trigger any registered event handlers without triggering the default action using the triggerHandler method.

hobbs
Ok, bad example what about onChange? my question was more relating to in general would any such events occur.
yongjieli
No again, because the "change" event is defined to be triggered when the data in a field is changed *by the user*. As far as I know, all events have similar caveats; they won't be triggered by code unless you go out of your way to simulate user interaction.
hobbs
That makes sense, the trigger methods works well thanks hobbs.
yongjieli