javascript-events

Remote Ajax Call in jQuery .click() function doesn't finish before going to next page.

I need to send click information on my website to a third party server using ajax (json). I am using jquery and I added the click event to certain links. In the click event I am making a json request to a remote server with the location of the click (heat map) and some other information. The problem is that the ajax function doesn't fir...

How to decorate a DOM node's event handler?

How can you decorate a DOM node so that you add an event handler, but within the new handler you can call the previous handler? ...

Monitoring DOM Changes in JQuery

Is there a way to detect when the disabled attribute of an input changes in JQuery. I want to toggle the style based on the value. I can copy/paste the same enable/disable code for each change event (as I did below) but I was looking for a more generic approach. Can I create a custom event that will monitor the disabled attribute of s...

Detecting a image 404 in javascript.

After a user uploads a file we have to do some additional processing with the images such as resizing and upload to S3. This can take up to 10 extra seconds. Obviously we do this in a background. However, we want to show the user the result page immediately and simply show spinners in place until the images arrive in their permanent home...

Problem with onMouseOut event with select box options (IE)

Hello All, The problem I am facing with below code is that whenever I try to select any option from the select box, the mouseout event executed (in IE, Mozilla doing gr8) and option disappear. How can one get over this bug. <select name="ed" id="ed" dir="ltr" style="width:200px;overflow:hidden;" onMouseOver="this.style.width='auto'" o...

Javascript get anchor href on click

Hello guys! How can I get the href of an anchor when I click on it using javascript? I did the following: function myFunc() { } window.onclick = myFunc; But how to extend the function to respond only to clicks on anchors and get the href? ...

Call click event on last clicked row in YUI datatable

Hello, I have a YUI datatable and I have a function which is invoked when I click on a row: ... YAHOO.keycoes.myDatatable = myDatatable; ... myDatatable.subscribe("rowClickEvent", oneventclickrow); var oneventclickrow = function( args ) { ... } I'd like to invoke the function subscribed to rowClickEvent on the row which is curren...

JQuery plugin: catch events for clicking/tabbing into and out of an input box

I'm creating a Javascript JQuery Timepicker control plugin (which I hope to open source soon) and I would like some advice on how to best register the events in the cleanest way. The control will attach to an <input> box and provide a graphical way to enter times of day ( 14:25, 2:45 AM, etc...). It does this by adding a <div> after the...

Event Listeners in HTML5 Video on the iPad Safari not working?

I've got this in the <head>: <script> function log(event){ var Url = "./log.php?session=<?php echo session_id(); ?>&event=" + event; xmlHttp = new XMLHttpRequest(); xmlHttp.open( "GET", Url, true ); xmlHttp.send( null ); } </script> And this in the <body>: <video id="video" src="./video/Larr...

What's the recommended way to create an HTML elemnt and bind a listener to it using jQuery?

At the moment I achieve this using something like this: var myElem = "<tr id='tr-1'><td>content</td></tr>"; $("#myTable").append(myElem); $("#tr-1").click(function() { // blah blah }); Traditionally, when I wasn't using jQuery, I used to do something like this: var myElem = document.createElement(...); var myTable = document.getEle...

Using jQuery's animate(), if the clicked on element is "<a href="#" ...> </a>", the fucntion should still return false?

I was reading jQuery's page for animate() http://api.jquery.com/animate/ Its examples don't mention about if using <a href="#" id="clickme">click me</a> ... $('#clickme').click(function() { $('#someDiv').animate({left: "+=60"}); }) we actually still have to return false like in the old days? $('#clickme').click(function() { ...

In Javascript event handling, why "return false" or "event.preventDefault()" and "stopping the event flow" will make a difference?

It is said that when we handle a "click event", returning false or calling event.preventDefault() makes a difference, in which the difference is that preventDefault will only prevent the default event action to occur, i.e. a page redirect on a link click, a form submission, etc. and return false will also stop the event fl...

Trigger events from Firefox browser extension?

Hello, I want to trigger events from a firefox extension, specifically click events. I've tried jQuery's .click() as well as the whole: var evt = document.createEvent("HTMLEvents"); evt.initEvent("click", true, false ); toClick[0].dispatchEvent(evt); This is not working for me, and I was wondering if this is even possible? (to tr...

Binded click loses context of my Class. JS

Hi, I have this problem that I probably understand but don't know how to handle, if there is a way. I have a class simplified as this: function DrawingTable(canvas_id){ this.canvas_id = canvas_id; bind_events() function bind_events(){ $(get_canvas()).click(function(e){ var canvas = get_canvas() //works do_something_in_...

javascript event e.which?

What is the functionality of javascript event e.which? Please brief with example. ...

HTML5 / JS storage event handler

Hi all, I'm using safari webkit's engine together with HTML5 and JS to create an offline application now I'm using the sessionStorage array to store status of my application(simulation). the storage data works fine with the inspector the functions work fine it's the event handler that isn't responding the test preformd by Anurag at ht...

Can you use Javascript to detect a file download window created server side?

I have a jQuery plugin I use to dynamically create and render a form on a default.aspx asp.net page, then submit it. The page it gets submitted to is a pdf.aspx page. The page builds a PDF then uses Response.Write to write the file (application/pdf) to the browser. I use the same method to render XLSX files to the browser as well. It...

Simply trying to submit a simple form inside form, weird behavior

I have a ad banner that has a form and this is used by 3rd party site owners that grab this code and have this banner on there site. Since some sites that use this banner have a <form> wrapping there entire site i have found that the banners form doesn't submit it rather submits the outer form. Here is the code: <form onSubmit="retu...

Where is a good javascript reference for object event handlers?

I am relatively new to Javascript and constantly need to look up how to handle various events for objects. For example, I have a table containing a few text fields and need to know when somebody starts typing in any of the text boxes. Is there any good concise reference on the web anyplace that documents all of the objects and event ha...

Javascript onbeforeunload Issue

Alright, I have an issue with the following code. What happens is when a user closes their browser, it should prompt them to either click OK or click CANCEL to leave the page. Clicking OK would trigger a window.location to redirect to another page for user tracking (and yes, to avoid flame wars, there is a secondary system in place to as...