javascript-events

How to identify if a key is down on hover ?

I would like to show one div only when another div is hovered and the Space Bar is down. I tried to use keyCode and which properties of the event, but none of them worked. Though, I could create an example for CTRL key pressed rather than the Space Bar, as you can see also here. How should I change the code so it will work with Space Ba...

why is my jQuery not binding my event?

I thought I understood JQuery, evidently not. Why, in this example, does the first textbox register clicks but not the second? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4 /strict.dtd"> <html> <head> <script type="text/javascript" src="jquery-1.4.2.min"/> <script type="text/javascript"> captureKeys...

What is the best way to execute a function when user clicks on a link?

From my experience I know three different ways to execute a Javascript function when a user clicks on a link Use the onclick attribute on the link <a href="#" onclick="myfunction();return false;">click me</a> Use the href on the link <a href="javascript:myfunction();">click me</a> Don't touch the link, do everything in js <a href...

How to get a list of all elements that resides at the clicked point ?

On user click I would like to get a list of all elements that resides at the clicked point. For example, if user clicks on Hello here: <div><span>Hello<span></div> I would like to get the following list: <span> element <div> element <body> element <html> element What would be the easiest method to get these elements ? ...

jQuery mouse events on underlying objects while dragging image

I'm trying to implement a simple drag/drop of images between panels using jQuery. While dragging I create an thumbnail image that I position under the mouse. This part all works but since the mouse now always has the thumbnail under it I don't get mouseenter/leave on the underlying drop target panels. I was hoping to use these events t...

window.onfocus not firing in IE7, inconsistent in Opera

Note that this relates to focus and blur events on a window, not on form fields. I'm loading a document in a pop-up window, and it includes the following code: <script type="text/javascript"> window.onblur = function(){ document.title="BLURRED"; } window.onfocus= function(){ document.title="FOCUSED"; } </script> These functions are t...

JavaScript: Where could I find the the code of original event handler?

Where could I find the the code of original javascript event handler? Is it in JavaScript? Thanks. ...

pass e parameter, jQuery

Hi, I have the following code in my document ready: $('a').click(function(e) { e.preventDefault(); var $this = $(this); var horizontalPadding = 30; var verticalPadding = 30; $('<iframe id="externalSite" class="externalSite" src="' + this.href + '" />').dialog({ title: ($this.attr(...

Writing callback functions

I'm using jQuery to write things like this: $('#current_image').fadeOut(function(){ $('#current_image').attr('src',newImage).show(); }); This is lovely, once the fadeOut has completed, the nested bit executes. I'd like to make my own function here that would replace fadeOut. What would my function look like so that th...

How to identify when the DOM has been changed ?

Is there a simple way to know when the DOM has been changed ? Is there any built-in JavaScript/jQuery event/function for this ? ...

Is this possible to force execution of .click() for all elements, even those that are underneath ?

Consider this code: HTML: <div class='a'>a</div> <div class='b'>b</div> <div id='log'></div> CSS: .a, .b { width: 100px; height: 100px; border: 1px solid black; position: absolute; text-align: right; } .a { left: 100px; top: 100px; } .b { left: 150px; top: 150px; } JS: $('*').click(function(e) ...

Click event firing multiple times

I am learning to write a plugin for myself, but I got something odd in the code. I have a reset button, and when I click it, it runs as times as the number of input elements I have. My code: jsbin, jsfiddle HTML: <div id="container"> <div id="createCSVWrap"> <fieldset> <legend> Create the CVS File </legend> ...

Cross browser event handler must capture [ENTER]

Inside a function I have an event handler. So far so good. But in that event handler I want to capture Enter pressed and replace that for a HTML. I've done it like this: CrossBrowserEventHandler(Editor, 'keyup', function(Event) { myFunctionRef(idname, Event) }); var myFunctionRef = function myFunction(idname, Event) { ...

How to capture mouse click with javascript when the mouse has moved between mousedown and mouseup

Hi, I am building a website with a scrolling javascript time line, using code from this tutorial. There is a demo to go with the tutorial here. My problem is as follows: if the user clicks on the timeline to drag it, and they happen to click on a link, then when the mouse button is released, the browser interprets that as a click on ...

Event.observe DOMNodeRemoved does not work in IE

I'm using this : Event.observe('${action.extUnenrolledListId}List', 'DOMNodeRemoved', function(event) { } It works in Firefox, but in IE8 the DOMNodeRemoved event isn't recognized. Any ideas about an alternative? Greetings, Niek ...

get text box value when i type the value by every press

hi i want to know get text box value when i type the value by every press. i have to get the value. if i type numbers i have to get. so i have checking with that value. thanks in advance ...

Listen to a dynamic number of dojo widgets (dijits)

I need to dynamically generate a webpage UI using javascript and dojo. I need to listen to the generated widgets in order to react on user input, but I cannot determine which one was changed... var combobox = new dijit.form.ComboBox( { id: id, store: dataStore, onCh...

Does a javascript bookmarklet have access to browser events?

Basically, the bookmarklet needs to look at the domain of the site that is being loaded, and if it is one of our domains, pop-up a window for action... However, most bookmarklets need to be explicitly activated by the user using a click on the bookmarklet. Is there a way to make the bookmarklet aware of every new window/page loaded b...

How to create a textarea with jQuery and/or javascript ?

I need to create a textarea with jquery and/or javascript. I am using this code ( click here for preview ) but backspace, enter, simbols and lowercase doesn't work. Why ?: <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt; <meta charset=utf-8 /> <title>TEST</title>...

.keypress on a DIV tag ??

Is there a way to get work .keypress on a div element like this?: <html> <body> <script type="text/javascript"> <!-- $('#idtext').keypress(function(event) { var keyCode = event.keyCode; $('#idtext').text(function(i, text) { return text + String.fromCharCode(keyCode); }); }); // --> </script> <div id="idtext"></div> </b...