javascript-events

jQuery handle Ajax timeout?

Hi, I'm trying to catch Ajax timeout error with jQuery 1.4.2, but none of tutorial I found work. In Firebug, when timeout error fires. I see uncaught exception: [object Object]. Please help me handle Ajax timeout. Here's my JS code: $.ajax({ type:"POST", url:"/data/add/", data: { "date":$("input#date").val(); },...

right click event (onclick) in chrome, opera and IE (javascript)

in Firefox I used the document.onclick event and then checked if it was a right click, and If i right clicked everything went as expected. But in Chrome, Opera and IE8, if I right click the document.onclick doesn't fire. I want to have a custom context menu for img elements. How do I go about this? ...

Adding event so i can extract pager

Hi, I have been trying to extract the pager functionality from some javascript code to display some categories. This would allow me to re-use the same logic. I have the following click event wired up for when the first page link is clicked: $('.first-page').click(function(e) { e.preventDefault(); displayCategories(1); }); As ...

Paste only plain-text into editable div

i need to be able to allow a user to paste into an editable div (via whatever the user chooses: right-click and paste, shortcut key, etc), but i want to discard formatting and only take the plain text. i can't use a textarea since the div will allow basic formatting (bold and italic) if applied by user-initiated events. the onbeforepas...

Trigger function when the page stops scrolling

How can I trigger a function when the browser window stops scrolling? Either by mouse wheel, click, space bar or arrow key? Is there any event for such action? I have tried to search online but couldn't get any solution. I'm fine with a jQuery solution. ...

What events are fired on changing tab away and to a page?

I have an image slider that slides automatically. Because I'm nice, I want to ensure that it doesn't continue to slide when the user has a different window/tab focussed. What events fire when leaving a tab/window, and which fire when returning? ...

Firing DOM mouse events programmatically from JavaScript

Is it possible to programmatically fire mouse events in DOM? My sample case would be the following: <html> <body> <iframe style="width: 500px; height: 500px;" src="something.html"></iframe> <div id="layer" style="position: absolute; left: 0px; top=0px; width=500px; height=500px;"></div> </body> </html> Whenever the user cl...

How can I tell if a page has jumped to the anchor (#) in javascript?

I have some javascript that can appear on many different pages. Sometimes those pages have been accessed via a URL containing an anchor reference (#comment-100, for instance). In those cases I want the javascript to delay executing until after the window has jumped. Right now I'm just using a delay but that's pretty hackish and obviou...

Span tag inside contentEditable div needs keypress event

I have the following div in my html code: <div id="expanderInput" tabIndex="1" contentEditable></div> I'm using a contentEditable div as a simple, cross-browser method of making an auto-expanding textbox. I'm also doing input validation on what the user enters into this div. It is supposed to be a list of email addresses separated b...

How to determine if assets are downloading on a page?

I am attempting to observe the performance of a flash application on the client side using JavaScript. The main thing I'm interested in is if the flash application has completed downloading all of the assets it needs. Is there a way to determine if assets are still being downloaded by the browser regardless of the container downloading...

onBlur event overriding jQuery UI events

I have a textbox that is wired up using jQuery UI 1.8.4 autocomplete. I have the select event wired up so when the user chooses an item from the list it calls another javascript function that issues an ajax request to save the data and update an XML document. On the same textbox there is an onBlur event so that if the user manually typ...

Detect parent click button with javascript

Hello, I have a page with two buttons, one Button opens a popup window with the next function: function MM_openBrWindow(theURL,winName,features) { //v2.0 my_window=window.open(theURL,winName,features); } and I need to detect from that window(my_window) when the second button in the parent page is clicked and raise an alert. How can...

IE throws an "Object required" error when trying to use the Event Object from another window/frame

I found a JavaScript error in a script that I'm developing. I whittled it down to a pair of fairly concise pages that still produce the error: http://troy.onespot.com/static/4505/index.html http://troy.onespot.com/static/4505/iframe.html If you load the first page in Internet Explorer 8 (or probably 6 or 7, for that matter), give it ...

jQuery How to distinguish click() and dblcick() for a DIV element?

Hi! If I subscribe dblclick() and click() for a DIV element and make double click by mouse on the DIV, the click() handler calls first before dblclick() is called. How to avoid handling click() before the dblclick()? UPDATE: The question has already asked before Prevent click event from firing when dblclick event fires. But here are goo...

intercept HTML Form and values with ExtJs

I'm trying to intercept the submission of a form in order to create an Ajax request in a Viewport using ExtJS. Some forms have no name (or not Id) and in many cases the submit button has been changed by a simple buttom. case 1: <form action="?m=pros&a=add" method="post"> <input type="hidden" name="project_type value='software'> ...

Multiple pictures and prewievs in Jcrop. How to pass many id's to javascript function

I use Jcrop plugin(Jquery) in my app. I decide to use some ajax solution but have a problem with passing value to function. I don't kno whether it is my lack od JavaScript skills or Jcrop issue. Here is code jQuery(window).load(function(){ jQuery('#cropbox').Jcrop({ onChange: showPreview, on...

Tracking open pages with ASP.Net

I'm sure that this question has already been asked, but I don't really see it. Using asp.net and c#, how does one track the pages that are open/closed? I have tried all sorts of things, including: modifying the global.asax file application/session start/end operations setting a page's destructor to report back to the application ...

How do I replace an event handler with jQuery?

I have a site that uses AJAX to navigate. I have two pages that I use a click and drag feature using $(".myDragArea").mousedown(function(){ do stuff... mouseDrag = true; // mouseDrag is global. }); $("body").mousemove(function(){ if (mouseDrag) { do stuff... } }); $("body").mouseup(function(){ if (mouseDrag) { do st...

Jquery if anyone understand this url please explain me

Hi, im using jquery bind,detach etc etc but i found this link which is worth but i donno the exact thing in it http://tiny.cc/1sdz2 please anyone explain in detail about this. Thanks, Nithish ...

How to develop a real-time event analytics solution?

Hello all. I need to develop an in-house real-time event analytics solution for our web application (e.g: mixpanel, chartbeat, kissmetrics like tool). We mainly use ruby on rails, Redis, MySql and JavaScript. The analytics solution must have an API and must be real-time. I've never done any API nor worked with real-time data. What te...