0
I have the following situation:
$('input[name=buscar]').on( "keydown keypress keyup", function( event ) {
console.log('foi');
});
Every time I type, all 3 events are triggered. How do I make only 1 be triggered instead of all three? I mean, I hit the button, triggered the first event, once I should do it and that’s it...
If identifying the added event can be as mentioned below, if to perform only one specific event remove the others.
– Gabriel Rodrigues
@Gabrielrodrigues The way you quoted it right. But there was one time, I believe I used some function, where she stopped the other events, so I don’t need to check event by event, he fired once, and didn’t perform the others. But I don’t remember the way I did it. ATT
– abcd
If you don’t have a specific case becomes difficult to help, these three events work "almost" at the same time, maybe you should analyze which event is ideal and use it
– Gabriel Rodrigues
Why do you have the 3 events associated with this input?
– Sergio
@Sergio Years ago I had problems using only 1 event, from then on I always use the three... 'Cause there’s no way you’re gonna miss an event...
– abcd
@abcd ok, but adding the 3 weighs in the performance of the browser, and generates problems like this one you are having. You should always add only what you need to the functionality you need. In some cases you may need more than one. What is the functionality you are looking for?
– Sergio
@Sergio Regarding today, It generates some visualization problems, minimums that will not interfere. But in the past I already had problems when I used ajax, because it requests 3 times... What the user answered solves. But years ago, I have in mind that I solved this same problem in a more "elegant" way, where if I had fired any of the 3 events, he would not repeat the others... But for having doubt, I don’t remember what I did back then. ATT
– abcd