javascript-events

How intercept these two key: ":" and "." ?

I need to do something when a user push "." and something else when an user push ":" Is there a way to intercept these 2 key with javascript, jQuery or other ? ...

Javascript add events cross-browser function implementation: use attachEvent/addEventListener vs inline events

In order to add events we could use this simple 1st solution: function AddEvent(html_element, event_name, event_function) { if(html_element.attachEvent) //Internet Explorer html_element.attachEvent("on" + event_name, function() {event_function.call(html_element);}); else if(html_element.addEventListener) //Firefox &...

Jquery + jqueryui - focusing on text field not working for FF

I'm trying to select a text field inside the tab, when the tab is clicked. The jqueryui event is correctly bound - have tested by putting alerts & by replacing focus() in the below code with hide(). But when I say focus(), it does not focus inside the text field. This is for FF 3.6.10 Code as below - $( "#tabs" ).bind( "tabsselect", f...

how can i check that at particular position there is a element present or not

how can i check that at particular position means particular x and y position there is a element present or not in jquery , javascript ...

JQuery: best place to put html tag handlers

Where do you personally prefer to put html tag handlers with JQuery-powered Html page and why: html tag element or document.ready function ? <a onclick="javascript:foo()" /> ... function foo() { ... } or <a id="mytag" /> ... $(document).ready(function() { $("#mytag").click(function() { ... }); }) Thank you in advance! ...

IE, textarea value is not changed when pressing buttons

I have an realy nasty problem with focus in internet explorer. I have a textarea for inputing text. This textarea is not visible for the user and is only used to provide robust text input for a more advanced view. As the textarea isn't visible and shouldn't be i use textarea.focus() in the javascript to activate text-input. This has wo...

Get "event" object within the immediately executed function?

I use event delegation in such way: elWraper.onclick = (function(){ //how to get here "event" object e = e || window.event; var t = e.target || e.srcElement; //event handler return function(){ //manipulations with "t" variable } })(); how to get "event" object within the immediately executed function? ...

triggerHandler vs. trigger in jQuery

Out of curiosity -- what is the purpose of / use cases for jQuery's triggerHandler? As far as I can tell, the only "real" differences between trigger and triggerHandler is whether or not the native event fires, and event bubbling behavior (though triggerHandler's bubbling behavior doesn't seem hard to replicate with trigger in a few more...

JavaScript question: Onbeforeunload or Onunload?

So I want to store some information in localstorage of a browser when the page is refreshed or the user exits the page for future use. I figured that I'd use some Javascript to detect the event and store the state of the page visit. Now my predicament is: shall i use Onbeforeunload or Onunload method to accomplish this objective? Tha...

Format a string using a string pattern

Hello, I have a displayFormat pattern "$###,###,###;-$###,###,###;#"( it can be different too) and I want to reformat the value in the AspxTextbox after deleting the ',' on GotFocus and LostFocus events by calling the following JavaScript function : function TextBoxFormat(ctrl, e, displayFormat, charactersToRemove) { var value = ctrl....

Page refresh with onclick event in dojo and I don't want a page refresh

For some reason in ie8 when I run this function after an onclick event it causes a page refresh. I don't wan the page refresh to happen. var edealsButton = dojo.byId("edeals_button"); var edealEmailInput = dojo.byId("edeals_email"); var edealsSignup = dojo.byId("edeals_signup"); var edealsThankYou = dojo.byId("edeals_thankyo...

Pausing the detection of mousemove

PPK at quirksmode.org says, Sometimes the mousemove event continues firing even if the mouse does not move. This is not a browser bug, but an OS or maybe even hardware bug. Some optical mice keep on sending mousemove interrupts, even though they aren't moved. In general this bug is easy to work around: just check the mouse posi...

Prototype Form Submit Validation Error

I have a form with id 'new_profile_choices', and I am using Prototype to validate the form. When I tried to validate the form submit event, it does not seem to handle the event. Could you please help me to debug it. Thanks View Source of the Form <form action="/polls/vote" class="new_profile_choices" id="new_profile_choices" method="po...

How to find out which JavaScript events fired?

I have a select list: <select id="filter"> <option value="Open" selected="selected">Open</option> <option value="Closed">Closed</option> </select> When I select Closed the page reloads. In this case it shows closed tickets (instead of opened). It works fine when I do it manually. The problem is that the page does not reload when ...

when mousing over a link I want the div that contains the link and other content to increase in height then back down to 19px on mouse out

I'm customizing forum software each page has 20 threads each thread is contained inside a div whose class="threadpreview" inside of each "threadpreview" divs are the LINKs to the full thread, and a 500 character preview of the thread right beneath the link when the page loads up, I have all the divs' height set to 19px and overflow:hid...

window.onbeforeunload functionality

When the user click on the OK button before redirecting how to call the delete function and then continue redirecting $(document).ready({ window.onbeforeunload = confirmExit ; }); function confirmExit() { var ele = document.getElementById ("localchanges") ; if (ele.value == "1") return "Changes are not saved. Discard change...

How Does One Attach A Handler To A Link Which Is Dynamically Loaded?

How do I attach a handler to the click event of a link, which is dynamically loaded i.e. it is only loaded in response to another action on the page? N.B. I am asking how to do this using the Prototype JavaScript library, but am not adverse to additional examples in JQuery as well. In the code below, the link is inside the page fragmen...

How Does One Trigger Click Event When Link Is Above Another Link?

I have a link covering which contains an image and a paragraph on a page, there is another link is positioned over this one and has a higher z-index. When I click the link the event handler for the link below is triggered. How do I trigger the event handler for the above link? Edit: To be more specific, the link that is underneath is...

How can I use autocomplete with event binding?

Hello, this is my first post here, I've found answers here before I have a form where I can add fields that have autocomplete. Instead of adding the autocomplete to each field as I create them, is it possible to use event binding to add the autocomplete? I am a newbie when it comes to events in javascript. This is what I have done to add...

Dynamic Ad Code Replacing Page

I have an application that uses a mobile ad provider; the way ad provider works is that I make a request on the server side, the provider returns me the mark-up and I include that on my site. In order to make the load page faster (which is a requirement that I don't control), I have an AJAX call to my server which then makes the call to...