javascript-events

Toggle visisbility of div with javascript

I think the problem was i was writing .innerHtml and overwriting the form elements, is that correct, sorry to waste your time Hi, I am trying to toggle the visibility of a div containing some form elements. The idea is that if the person selects a particular value of a select box an onchange event handler will make a particular div conta...

Regex Expression Problem...

I have the following regular expression /[^a-zA-Z0-9 ]/g I want include " in the following piece of code onKeyUp="this.value=this.value.replace(/[^a-zA-Z0-9"]/g,'') I used the above regex The problem I am facing over here is that the above regular expression allows me to include other special charaters (&, *, etc.) into it. How do...

Catch only a left clicks on links.

We are using event "click" to catch click on links and load content via ajax. But event happens also on right mouse and wheel clicks. How to process only left? confused // jquery.coyod-engine-0.5.0.js $(document).click(function(e){ var t = $(e.target); if(t.hasClass('aj')) { e.stopPropagation(); e.preventDefault();...

Javascript race condition question

EDIT: I figured out the answer to the original YUI3 question I posted here, but it led to another one and instead of starting a new thread I thought I'd just add it here. Please scroll down for the new question (it's bolded). Original question: I'm having some issues creating a JavaScript countdown timer inside a YUI definition, my gues...

How to add event handler to AJAX Control Toolkit Extenders

I have been trying to add a toggle button using the ToggleButtonExtender and the MutuallyExclusiveCheckboxExtender. However, I cannot add an additional client side event handler for the click event of the Extender created button. I tried to add a BehaviorId that I access in the onLoad of the Javascript via the $find('') function. However...

How to raise a global event in dojo?

Hello, I am trying to raise an event to all of the widgets that catch it. I have an authentication widget and other widgets that depeand on the fact that the user is logged in. I would like to raise an event to all of those widgets when a user is logged in without connecting them manually. How can it be done? Thanks in advnace, Omer. ...

Programatically trigger an onclick event?

I am trying to simulate an asynchronous file upload using an iframe. Here is my markup: <form method="POST" enctype="multipart/form-data" name="change-avatar" action="/dyn/actions/upload?type=profile" target="target-upload"> <input type="file" name="change-avatar-input" style="position: absolute; z-index: 999; cursor: pointer; left: 10p...

window.resize event firing in Internet Explorer

As you are aware, in Internet Explorer, the window.resize event is fired when any element on the page is resized. It does not matter whether the page element is resized through assigning/changing its height or style attribute, by simply adding a child element to it, or whatever -- even though the element resizing does not affect the dime...

The proper way to handle popup closing

I'm looking for close event for popup. I've found one for XUL, but I need it for HTML. Popup has closed property. >>> var popup = open('http://example.com/', 'popup', 'height=400,width=500'); >>> popup.closed false Well, I can check it once at half second. function open_popup() { var popup = open('http://example.com/', 'popup', 'h...

jQuery check if onClick exists on element

I found the way to check if event exists on element. But it's not work on the events which is not delegated by jQuery... When I try, $("a").data("events"); for this. <a href="#" onClick="alert('Hello, World!')" /> It returned undefined. Is there any way to check if onClick exists on elements with jQuery? Thanks. ...

Firing contextmenu event in Firefox AddOn gives different Elements (XPCNativeWrapper vs. XULElement)?!

Hi folks! Executing this JavaScript: window.addEventListener("contextmenu", function(e) { afunction(e); }, true); function updateReflectMenu(anEvent) { var elemUnderMouse = anEvent.target; alert(elemUnderMouse); } within an AddOn in FF3.5 gives me something like: [object XPCNativeWrapper [object HTMLSpanElement]] Exactly what I...

uservoice javascript widget - How to popup feedback form automatically on page load

In an HTML page, how can I know when a externally loaded javascript object is defined and ready for methods to be called on it? Problem specifics: I'm using the uservoice feedback web application including their javascript widget and their SSO (Single-SignOn) option. Everything works fine. There is a prominent Feedback tab stuck on t...

Javascript: Is there a way to tell when a div has been added to an element?

Say I have a third party twitter widget on a page which keeps updating whenever there is a new tweet. Is there some way to figure out when a new div has been added to this widget? Is there an event or something I can hook onto (on maybe the widgets parent div)? If there isn't, how do I do this? Maybe hook onto the ajax calls the widget...

javascript proplems

lets say i have a list of links: <a id="home" href="#"> home link </a><br/> <a id="list1" href="#"> some text1 </a><br/> <a id="list2" href="#"> some text2 </a><br/> <a id="list3"> href="#"> some text3 </a><br/> <a id="list4" href="#"> some text4 </a><br/ <a id="list5" href="#"> some text5 </a><br/> <a id="list sails" href="#"> sails...

Is this a IE8 or jQuery's bug?

<option> doesn't respond click/contextmenu events in IE8? Here is all the code to verify it locally: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-type" content="...

How to programmatically change the OnClientClick event and call it?

I have a ListView that contains playlists. If the user wants to edit an album, they click the edit link and it allows them to remove or add songs to the playlist. If the user wants to Save a new playlist while keeping the original one, the would click a Save As Button. Here is what should happen: If the user clicks Save As and they h...

Javascript pageLoad not executing in a master page

What causes the following pageLoad to not execute in a master page? The first alert executes as expected, but the pageLoad function is not being invoked. How can I use the function within a master/content page? <script type="text/javascript"> alert('test'); function pageLoad(sender, args) { alert('pageLoad'...

jQuery selectors help

I have the following HTML <ul class="main-navigation"> <li class="left">&nbsp;</li> <li class="normal">Home</li> <li class="normal">Internet</li> <li class="normal">Movies</li> <li class="normal">Music</li> <li class="normal">Documents</li> <li class="normal">Windows</li> <li class="right">&nbsp;</li> </ul> What I want...

How do I make an HTML button not reload the page

I have a button (< input type="submit"/>). When it is clicked the page reloads. Since I have some jQuery hide() functions that are called on page load, this causes these elements to be hidden again. How do I make the button do nothing, so I can still add some action that occurs when the button is clicked but not reload the page. ...

Dynamically creating a textbox with a javascript onkeyup event that takes parameters

What I have is a single textbox. If the user hits the maxlength of it, I want to create a new textbox and then change focus to it so they can continue typing. To accomplish this, I am trying to dynamically create textboxes that have an onkeyup event tied to them. To do this I am using document.createElement and the creation of the e...