Questions tagged [preventdefault]

Javascript event method to cancel the event if it is cancelable, without stopping further propagation of the event.

Javascript event method to cancel the event if it is cancelable, without stopping further propagation of the event.

960 questions
9
votes
6 answers

Prevent browser pop on taphold event

In a jquery-mobile based web app, how do i prevent the default browser menu from showing on "tap hold" .. instead i want to show a custom dialog page .. mentioned below is my code as of now .. $(".task_row").bind('taphold',function(event, ui){ …
Abhishek Jain
  • 971
  • 3
  • 13
  • 18
9
votes
7 answers

event.preventDefault(); not stopping mousewheel in Firefox

I am using the mousewheel in jquery to increase the number of a div, the number increases correctly but the scroll is not stopped in Firefox. $(document).ready(function(){ $('#test').bind('mousewheel DOMMouseScroll', function(event){ …
Michael
  • 147
  • 1
  • 2
  • 10
8
votes
3 answers

Flutter: How can I prevent default behaviour on key press?

I'm trying to intercept when a user presses the volume buttons to perform a specific action and prevent the default behaviour (volume changes). This is the code I have so far: RawKeyboard.instance.addListener(_keyboardListener); void…
joseph
  • 81
  • 4
8
votes
1 answer

Stop spacebar from scrolling page

I know that e.preventDefault(); is supposed to stop the spacebar from scrolling on the page, but it is not working on my function $("html").live("keyup", function (e) { var code = (e.keyCode ? e.keyCode : e.which); if ((code == 32 || code ==…
sir_thursday
  • 5,270
  • 12
  • 64
  • 118
7
votes
3 answers

how to prevent focus event in IE when mousedown happens

event.preventDefault(); return false; event.stopPropagation(); any of them can prevent focus event from happening when I trigger a mousedown event in Firefox and chrome, but it failed in IE.In fact,chrome has another problem. when mousedowning,…
Jinceon
  • 1,292
  • 2
  • 13
  • 21
7
votes
3 answers

Disabling routerLink with stopImmediatePropagation method

Task - Create a reusable button/anchor tag attribute selected component for an Angular library, with as much of the logic for the behavior tied up in the component itself not on the HTML markup. HTML markup should be as clean as possible ideally
7
votes
2 answers

How do I stop bots from using .submit() to bypass my 'required' fields?

I have a form which is producing a lot of spam. I have made all inputs required and have attached a captcha. This has not had any affect. I assume the bots are using form.submit() as for some reason this bypasses all my required fields AND also…
tjway
  • 79
  • 2
7
votes
6 answers

jQuery preventDefault() not working inside AJAX call

So, I am doing a check when a user inputs an email to see if the email exists or not. $('form.recover-form#check-form').on('submit', function(e){ var form = $(this), input = $('.check-recover-email'), span =…
C. Ovidiu
  • 1,104
  • 2
  • 18
  • 38
7
votes
1 answer

How to make a form wait for ajax to finish before it submits?

So there is a form that i want to submit only when a condition is verified from the database using ajax. I am using preventDefault() method if the condition is true i.e. if a user is not a resident, a variable is set to true in ajax successs…
wayne
  • 393
  • 2
  • 13
7
votes
2 answers

Using preventDefault on a submit button

I am trying to solve a problem offered by a jQuery textbook. It reads like this "The data is submitted even though no entries have been made, to fix this you must stop the default action of the submit button. To do that, code the preventDefault…
user2113538
  • 93
  • 1
  • 1
  • 7
6
votes
3 answers

can e.preventDefault() be reversed?

i am looking for a way to .preventDefault() to make a transition and then allow the default behavior $('.withTrans').click(function(e){ e.preventDeault(); $(this).animate('opacity','0',300,function(){ e.resumeDefault(); //…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
6
votes
1 answer

Fully "Kiosking" Chrome (capture and prevent default of C-w/t/n)

I need to prevent Ctrl-w, Ctrl-t, Ctrl-n from doing their default functionality. I know removing user rights is frowned upon, but hear me out before casting judgement. event.preventDefault() only works on lesser key combos like p, but n, t, and w…
Bobby
  • 931
  • 2
  • 8
  • 21
6
votes
1 answer

Is this a core misunderstanding of the default click event on checkbox inputs, or flawed code?

When binding to a click event for a checkbox input, the checkbox is already toggled by the time my event handler runs and, more oddly, the toggle is reversed after my event handler runs if I specify event.preventDefault();
jsoverson
  • 1,695
  • 1
  • 12
  • 17
6
votes
0 answers

How do you use preventDefault() in React-Native

I am using TextInput of react-native-paper on IOS. I want to use preventDefault for button Enter, Tab, , buttons but I can't find the preventDefault method for react-native. Is there a preventDefault method or any other way on react native for IOS? …
Furkan
  • 61
  • 9