javascript-events

window.attachEvent doesn't work in IE

Hello! I want to display picture in a new window. For that I wrote javascript function that opens new window. I open window with some fixed size (for example 500 x 500). But I want to resize my window to picture size. For that I attach event to this newly created window. Here is only code for IE because in FF and Chrome all works. var ...

Mootools `Events` works just on first `click`, after stops working. Why?

Mootools Events works just on first click, after stops working. Hope someone have issue for that: http://jsfiddle.net/3j3Ws/ CSS ul li,li.selected div{ width:22px; height:22px; display:block; background:#000; color:#fff; text-align:center; border-radius:3px; } ul#list{ display:none; opacity:0; flo...

click() firing multiple times

I am using a document.getElementById("val").click() to invoke a click event, but it keeps firing multiple times. Here I add the eventHandler try { //add mousedown event handler to navigation buttons addEventHandler(oPrevArrow, "mousedown", handlePrevDayClick); addEventHandler(oNextArrow, "mousedown", handleNextDayClick); ...

jQuery live handler but for each()?

I know that live() can be used to support event handlers for current AND "added later" DOM elements. I wonder how to do the same thing with each()? Like if I have $('.something_or_other').each() but then another DOM element with class="something_or_other" gets added? How can I set it up to automatically apply the each iteration to this...

Google Maps API v3: Is there a callback or event listener for a setMap() event?

I am using Google Maps API v3 on a website I am developing. I have a drop-down box beneath my map which allows the user to switch between different sets of markers to be displayed on the map. Each marker is displayed using marker.setMap(). My problem is that the map sometimes takes a long time to display the new markers, especially in I...

How can I get the NEW value of an HTML text input during a keypress event via jQuery?

I can only retrieve the value without the newly pressed key. Using the keyup event isn't an option, because it does not fire if the user doesn't release the key. This is important because I want to act upon every single keypress. Combining the old value with the keyCode that is reachable from the event's arguments isn't acceptable eithe...

How to assign jQuery click events for the third click??

Hello, I'm trying to find a simple way to attach click events to an element, which is quite easy for the 1st and 2nd click events.. But, what I am trying to accomplish is a three click Toggle. 1st click = addClas('one'); 2nd click = removeClass('one').addClass('two'); 3rd click = removeClass('two').addClass('three'); next click would ==...

Custom events and who's the sender?

I'm using a component writen in javascript. The component is exposing some events. The problem is I can't figure out who is the sender. They don't provide an instance of the sender as a parameter (like jQuery does). My question is: Is there any way to hook up the event using javascipt/jquery or any other way to get the sender? All I...

.onload called multiple times from Firefox extension

I'm developing a Firefox extension and have the following code: function initialize() { // For accessing browser window from sidebar code. var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Compon...

JavaScript key handling and browser compatibility

Hi, I'm working on key handling in java script. I have done some research and I'd like to know whether I have a correct understanding of key handling. KeyDown/KeyUp Event The key down and key up events are supported by IE7+ and Firefox 3.5+ I didn't check the earlier versions of the browsers, but I guess that they also support these ev...

Append a "no results" message with jQuery

I'm using John Resig's LiveSearch with John Nunemaker Quicksilver score prototype to create a livesearch feature. I'm just trying to figure out how to append a message if no results were found, instead of just having a blank space when there are no results. Any help would be greatly appreciated. ...

javascript + google mashups, remove drawn objects

hi, here is an example of drawing polygons on google mashups. Can anyone show how to do the following: 1) Only let user only draw one object. 2) If user has drawn the object, and then presses again on some other object button then the previous object on google mashup is deleted. So that there is only one object always on google mashup.....

Refire the jQuery ready event ?

I am using the jQuery $(document).ready() event on page. All is fine, except that if I am loading data using Ajax calls, the $(document).ready() event does not fire. I guess that it behave in such way because the page was already loaded and I am just adding more data from the Ajax response to the DOM. How can i refire the ready event ?...

flash, javascript

I'm trying to make a flash form to freeze somewhere at the middle of the page even if the client scrolls down or up the page . Something similar with the left side "feedback" rectangle from http://uservoice.com/ . The flash form which I'm trying to integrate can also be found here http://www.macromediahelp.com/flash/php_flash_contac...

JS / Jquery: Unable to access the properties of an object returned from an ajax call

Hi I'm quite new to JS and jquery. Im having a problem accessing the properties of an object returned from the jquery ajax method. As you can see in the code below I'm trying to use the properties of the object 'data' in the success call back function to create a table row, which I then try and add to a table. $('#add_comp').submit(f...

Is it possible to trigger the onbeforeunload event programmatically?

I'm currently using the jquery-form-observe plugin which uses onbeforeunload to prompt the user about "unsaved" changes. But I have a scenario where I need to trigger this on a button click: the button click ultimately leads to the page changing, but I want to prompt the user before they start the process that the button click kicks of...

Question regarding jQuery click() function.

$('document').ready(function(){ $('[name=mycheckbox]').live('click', function(){ if($(this).is(':checked')) { alert('it is checked'); } else { alert('it is not checked'); } }); $('[name=mycheckbox]').click(...

clicking an <img> preventing the activation of the <a>

Hi all, I'm trying to implement a bookmarklet where the user will click one <img/> and will be redirected to another page where he will annotate the image. if the image is inserted within a HTML anchor: <a href="http://anywhere.org"&gt;&lt;img src=""http://anywhere.org/image.png"/&gt;&lt;/a&gt;, can I prevent the anchor to be activa...

How to perform action on keypress?

My code works perfect if I want to perform an action when pressin the ctrl key... $(document).keydown(function(e){ if(e.ctrlKey){ if($('.selected').parent().next().length == 0){ switchTabs($('.selected').parent().parent().find('a:first')); return false; }else{ switchTabs($('.selec...

remove an html button using js

Hi I have a bit of code below that creates a button on a html form. When a user has entered some information using the button I want the form to reflect this by removing the button and replacing it with just plain text. I have tried getting the inner html and using divs but nothing is working can anybody help please? I am not looking for...