no way... u r probably doing something wrong...

The problem could be that you are attaching click() event to the button in
multiple places in the code. This can usually happen, when you have multiple
js files and unknowingly attach the event twice. This is not the same as
button.onclick = function();. this type of event association will over-ride
each other, but when using jquery's button.click(function(){}) each event
handler gets added to the previous.

-GTG

On 6/26/07, roryf <[EMAIL PROTECTED]> wrote:


Hi,

I've come across some behaviour that seems a bit odd to me, not sure
if its by design or a bug. I've been trying to fire the click event of
a button with the following:

$('#mybtn').click();

However this causes the click event to fire twice, the result is the
form being submitted twice. I was able to fix it by using instead:

$('#mybtn')[0].click();

Which only fires the event once. This only happens with buttons
(type="button|submit|reset") not any other element I've tried like
hyperlinks. I haven't tried it with a collection of buttons rather
than one selector, I guess that would be the next step. So, is it
supposed to do this and if so why?

Cheers,
Rory Fitzpatrick


Reply via email to