preventDefault doesn't take effect in firefox

I have an input named shop_cat_edit and the code as below. But in FireFox this code never works... Even IE feels ok with it. What am I doing wrong?

$('[name=shop_cat_edit]').on('click',function(e){
   $('#shop_cat_selector_form').on('submit', function(){e.preventDefault();}); 
});

Answers 1

  • The variable e is not declared in the function you use it

    function(){             <-- no function param for event is set here
      e.preventDefault();
    }
    

    It should look like this

      function(e){e.preventDefault();}
    

Related Articles