0
   $(".navbar-header button.navbar-toggle").on("click" , function(event){ 

       event.preventDefault();
       alert("I am alert");

  });

In above code preventDefault() is not working properly. Is there any another way to prevent event click. I need to disable all js events on this click. Thanks.#preventDefault();

3
  • 1
    Does this answer your question? event.preventDefault() vs. return false Commented Dec 21, 2019 at 5:31
  • 1
    As @chandukomati said simply return false on click even. Commented Dec 21, 2019 at 5:47
  • But, I want this event fires at end of all events on this click. Is there any way Commented Dec 21, 2019 at 6:14

1 Answer 1

1

You can try like this -

 $(document).on('click','.navbar-header button.navbar-toggle',function(event){

     event.preventDefault();
     alert("I am alert");

});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.