I am new to the prototype framework and am trying something really simple and failing. I am trying to respond to a click event on a button like so:
$$('.btn').observe('click', respond);
function respond(event) {
alert("hello");
}
Why isnt this working?? Please help!
...
Reading another SO question about jQuery performance, I started thinking about the point when it becomes worth using event delegation rather than binding to elements individually. I was thinking mainly about jQuery, but I suppose it is probably applicable for Javascript in general.
Event delegation has two main purposes:
allowing han...
Hi,
I am noticing that the closeclick event on InfoWindow is being called prior to InfoWindow display in Google Maps V3. Has anyone else seen this? Bug? My misunderstanding of design?
Consider the simple example:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
...
Hello,
Is there a way to Observe the Contents of a specific DIV, I want to call a function as soon as the contents of the DIV are Changed.
This can be a innerHTML replace, a page load.
Thanks
...
Is it possible to use javascript to handle the event of refreshing page?
What i want is get notice if user do one of these behaviours:
refresh page by pressing F5
close tab or browser
enter a new url then press enter on
browser
to display a warning message?
Thanks in advance!
...
I'd like to add a feature to the awesome GleeBox project and it involves intercepting requests to create new tabs (so command-T on OS X). I know this sounds like a bad idea but bear in mind this is for an optional extension!
Anyway, is it possible to intercept a modified key-event that is used for a "system" function such as this?
...
I have a flash document viewer embedded in my page, where the user can view the preview version of the document, and then purchase the full version if they like. Is it possible to have a hyperlink in the document itself "BUY NOW" which would command the browser to do something on the current page without having to refresh?
I'm imaginin...
When we use the method jQuery.Val( value ) over a DOM element to change its value.
shouldn't the element dispatch an event informing that its value has changed? -I though the event 'change' was going to be dispatched.
If it shouldn't why?
Live Demo
...
I've got an image map w/ 20 area elements, only four shown below. I want to style each area so that a blue border appears whenever a user hovers over it - all the area shapes are rectangles.
<map id="mymap" name="mymap">
<area shape="rect" coords="0,0,223,221" href="http://..." />
<area shape="rect" coords="226,0,448,221" href=...
If you have an element that has an animation to move it around, the mouseover and mouseenter events aren't fired unless the mouse is moved by the user. To demonstrate try the block of code below with jQuery.
If you put your mouse in front of the moving div so you're not moving the mouse when the div passes by then the mouseover isn't f...
Goal
When the user clicks an element (with class="menu"), the default action should not be executed. The user should be presented with a menu with options. When an option has been clicked, then the default action should be executed.
Problem
It's very problematic to stop the original click event in the first place, because it seems imp...
I'd like to use JavaScript only (no jQuery) to replace an inline onmenuclick event handler generated by a third party control with my own.
The custom control has added the following HTML to the page:
<ie:menuitem
menugroupid="200"
description="Create a site for a team or project."
text="New Site"
onmenuclick="if (LaunchCreateHa...
Let's say I have a web page with a header menu, when I click the header menu, it calls a servlet that creates the sidebar. Is it possible that without using the document.getElementById? And just simulate keystrokes "tab" and "enter" via javascript so I don't have to click the menu to view the sidebar?
...
What the best way is change file extention of Java?
...
How can I reliably detect all events that cause the the value of an HTML select to change, while that element still has the focus?
For regular mouse input, either the click or change event works fine. For keyboard input (and for mouse input using the scroll wheel), however, the change event doesn't fire until focus is lost. I get around...
Hi all,
I have heard in the past unload, or onunload, is not always called. However, I would like to know how often it is not called. What conditions lead to it not being called? Is this different for Firefox and IE?
Thanks,
Grae
...
At a certain stage, I am applying css to a section of my page.
Is there an event one can get once the re-layout has completed?
...
I am working with the script that will be checking the age from the current date and very simple logic that is by taking year input. Here is the code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Date Check</title>
<script language="javascript" type="t...
I'm running the following code in jQuery to dynamically load a stylesheet. Its purpose is to allow users to load a custom stylesheet and change the look of a JavaScript widget:
this.loadStyleSheet = function(url){
$("<link rel='stylesheet' type='text/css' />").attr("href", url).appendTo("head");
}
For a split second the screen app...
Suppose i have a html5/canvas application in which i can place objects on a drawing-canvas. Some kind of diagram editor, something like Visio (but much simpler)
Is there a framework which helps me find which object is clicked/draged?
An option is to capture the click-event and iterate over all my objects (in a semi-smart way) and che...