dom-events

Programmatically press "Left" key in a text input

I am trying to programmatically fire a key event to go left in a text box, but not having any luck. The input element has focus and the cursor is at the end. I'm trying to get the cursor to move left one step - before the letter "F" *programmatically by firing a Keyboard event (keydown/keyup/keypress) with the corresponding keystroke ← ...

assigning variables to DOM event listeners when iterating

I'm thinking there's some basic stuff that I'm missing here; for (var i=1; i<=5; i++) { var o = $('#asd'+i); o.mouseover(function() { console.info(i); }); } When hovering over the five different elements, I always get out the last value from iteration; the value 5. What I want is different values depending of which element ...

jQuery event.layerX/Y is not relative to the element that triggered the event, is that correct?

If I use for example a mousemove event handler on a div and check the layerX property of the event, it changes when my mouse enters a positioned element inside that div (like an image). According to the jQuery Event object documentation it should follow the W3C DOM Level 3 specifications. But there's no mention of the layerX/Y property...

Strange behavior of button: calling "onclick" parent's element instead of itself (HTML Button)

Hi all! I have following structure of web application, for which I'm automating testing: <em unselectable="on" class="x-btn-split"> <button type="button" class="x-btn-text " id="ext-gen523" title="Add Options">Add</button> </em> Both objects has event listeners,added viw JavaScript in some linked js-file (I don't know what f...

How to know when an DOM element moves or is resized

I'd like to know if there is a DOM event to listen for that tells me when a DOM element moves is repositioned or is resized on the page. I am not talking about an elements being drag/dropped. An example is if a have a list of three items on a page, and I use JS to remove one of the top two list items from the page (or hide it or whatev...

How to know which submit button fired the onsubmit event

When you have more than one submit button in a form, is there a way to know which one fired the onsubmit event without adding code to the buttons themselves?? Edit: I need to do the check on the client-side, i.e. with JavaScript. ...

Click through div with an alpha channel

Hey, I'm trying to replicate twitter's "fade out" layer at the bottom of the feed widget (on their main page at twitter.com). The only way I could come up with that didn't use html5 was place an absolute positioned div above the feed div, and give it an alpha channeled png with a white-to-transparent gradient above it. This was easy to...

List of an element's events

Is there a way to find all of the events for a element in javascript? or a way to unbind all events from a element? Thanks. ...

How is document.createEvent supposed to work with key events?

I'am trying to simulate keypresses in a web application, it is for an embedded system but it uses a Webkit derived browser. I have tested the code in Chrome and get the same error. I tried to use code snippets from this example from Yahoo, but I keep getting the same error when firing the event using dispatchEvent. "target" is an HTML e...