Search code examples
jquerytextboxlist

Jquery, Opera. How to stop submit?


i'm using this control http://devthought.com/projects/mootools/textboxlist/

It's using JQuery

Code:

bit.toElement().keydown(navigate);
 var navigate = function (ev) {
    var evStop = function () {
        ev.stopPropagation();
        ev.preventDefault();
    };

    switch (ev.which) {
    case 13:
        evStop();

        ...work...
    }
};

This code work fine in FF and IE, on pushing Enter it's stop form submit.

Q: But in Opera, page reload, how to fix that?

Solution: bit.toElement().keypress(navigate);


Solution

  • Perhaps, you could include a "return false", to the function.

    In case, this works.

    Try to change "keydown" by "keypress".

    Try this:

    $(document).bind("keydown keypress", function(event) then e.preventDefault() won't work try.. event.preventDefault()