#1264 new
Peter

Event.stop doesn't work on IE9

Reported by Peter | July 14th, 2011 @ 01:22 AM

If you have a form like this:


<input id='address' type='text' />
<input id="save_location" type="submit" value="Save" />

As you want to stop it from being submitted when save_location is clicked, you try to cancel it's click event.

$$("#save_location").each(function(element) {

$(element).observe("click", function(event) {
    alert('click');
    Event.stop(event);
});

});

$$("#locationFrm").each(function(element) {

$(element).observe("submit", function() {
    alert('submit');
    Event.stop(event);
});

});

It doesn't work on IE9. The submit event is still fired and you can't cancel it.

You can test the code at : http://jsfiddle.net/wb83h/5/

Comments and changes to this ticket

  • Victor

    Victor July 25th, 2011 @ 02:07 PM

    1. Choose Prototype-1.7, not Prototype-1.6. Everything works for me in IE9.
    2. Code can be cleaned, also you forgot the event argument for submit observer:
        $$("#save_location").each(function(element) {
            element.observe("click", function(event) {
                alert('click');
                Event.stop(event);
            });
        });
        $$("#locationFrm").each(function(element) {
            element.observe("submit", function(event) {
                alert('submit');
                Event.stop(event);
            });
        });
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Pages