I want to capture Tab and Shift-Tab in the onblur event of a dropdownlist in javascript. Is it possible? thanks, Kishore Answer onblur is not enough… You need to capture KeyEvents and check and store if tab/shift-tab are pressed. Then you can check for those keys in the blur-handler.
Tag: javascript
window.onload vs $(document).ready()
What are the differences between JavaScript’s window.onload and jQuery’s $(document).ready() method? Answer The ready event occurs after the HTML document has been loaded, while the onload event occurs later, when all content (e.g. images) also has been loaded. The onload event is a standard event in the DOM, while the ready event is specific to jQuery. The purpose of the
Remove key press delay in Javascript
I have the following problem: I’m trying to write a Javascript game, and the character is being controlled by the arrow keys. The problem is, when one keeps the key pressed, there is a short delay between firing the first keypress and the repeated keypress. Also, when one presses the “right arrow key” and keeps it pressed, and then presses
How can I get pixel data of every frame in a HTML5 element
I’m thinking I’ll have to wait for the video to finish loading, then set up an interval (at 1/24 sec.) to get the current frame data, for the duration of the video. But that seems pretty hacky and looks like it might skip frames and such… So, is there a “onFrameChange” listener I can hook on to, so I can
Incrementing a date in JavaScript
I need to increment a date value by one day in JavaScript. For example, I have a date value 2010-09-11 and I need to store the date of the next day in a JavaScript variable. How can I increment a date by a day? Answer Three options for you: 1. Using just JavaScript’s Date object (no libraries): My previous answer
IE6 Covering Div
I have a Google Map on one web page where I want to disable both scrolling and zooming. I accomplish this by having an empty DIV element with absolute positioning cover the map area. Firefox/Chrome work fine, but IE6 doesn’t really care about this DIV. For some reason, it just lets me drag the map. I set the DIVs background
How do I include – and ‘ in this regular expressions?
I have a this regular expression below for some input name fields. How do I include an apostrophe and a hyphen in this? Answer Hyphen is already included (twice), you can add the apostrophe by just editing it into the character class: You can rewrite it to look like this, so that there’s no need to escape the hyphen and
How do I check if file exists in jQuery or pure JavaScript?
How do I check if a file on my server exists in jQuery or pure JavaScript? Answer With jQuery: EDIT: Here is the code for checking 404 status, without using jQuery Small changes and it could check for status HTTP status code 200 (success), instead. EDIT 2: Since sync XMLHttpRequest is deprecated, you can add a utility method like this
Preloading images with JavaScript
Is the function I wrote below enough to preload images in most, if not all, browsers commonly used today? I have an array of image URLs that I loop over and call the preloadImage function for each URL. Answer Yes. This should work on all major browsers.
How to serialize current div by using $(this).parent() with JQuery?
I am trying to serialize the current div by using a clickevent. See code for good explanation: Alert will show nothing, which means the div is not being serialized. This is the html in question. It’s inside a dialog, which is also the reason why I have to use live(). Also this code is working without a problem to remove