Solved

input text box not behaving properly when debug points are set

Posted on 2016-10-25
4
28 Views
Last Modified: 2016-11-30
HI,
There is the following input html :
<input type="text" class="flock-js-input" value="..." placeholder="Search.." autocomplete="off">

And the following listener on it :
$('.flock-js-input').keydown(function(e){
    if(false) {

     }
});

$('.flock-js-input').keyup(function(e) {
     
});
The false is just the case i am testing and is not the actual values there...
Now when user types in something in input textbox and keydown listener invokes
But there are following issues :
1) keyup listener does not invoke
2) The textbox does not get filled with the key typed

This happens only when i have put debug points in firebug inside keydown listener.
When debug points are not set... things work perfectly fine... the keyup listener also gets invoked and textbox also gets filled with the keys pressed
What could be the reason for this.

Thanks
0
Comment
Question by:Rohit Bajaj
  • 2
4 Comments
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
There is nothing wrong with the code as you have posted. Consider this
<script>
$(function() {
  $('.flock-js-input').keydown(function(e){
    console.log('keydown');
    if(false) {
    }
  });

  $('.flock-js-input').keyup(function(e) {
    console.log('keyup');
  });
});
</script>

Open in new window

Working sample here - F12 to view the console when you do a key press in the <input> both events fire.

Without seeing all your code (if you have stripped code out) we can't diagnose.
0
 

Author Comment

by:Rohit Bajaj
Comment Utility
Hi,
In the same code that you pasted... if i put debug point on both the console statements then only the keydown event is fired and keyup is not also the textbox does not get filled up with the text.
I put the debug points in my firebug on your page
0
 
LVL 51

Assisted Solution

by:Julian Hansen
Julian Hansen earned 500 total points
Comment Utility
That is a function of the debugger - not the code. The code works but if the debugger is not caching the events for you to continue to debug with then that is an issue with the debugger.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video teaches users how to migrate an existing Wordpress website to a new domain.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now