javascript-events

Changing the Enter Mode in ContentEditable DIV

In content Editable DIV, on pressing the Enter Key,div tag is appended in chrome... Can it be possible to change it to br tag? I have tried the below code. But It is working only if i press "Enter" key twice,if i type some contents before it. For Empty lines, it s working fine. var range = window.getSelection().getRangeAt(0); ...

Capture mouse move from sidebar of a firefox plugin into the document

I am trying to do something like the following in my firefox plugin - I open a sidebar on which I show certain UI elements (like an image) and allow people to drag and drop those images from the sidebar onto the document. I am trying to achieve my goal by doing this: var currentWindow = Components.classes["@mozilla.org/appshell/wind...

What jQuery event/method can I use to bind on a dynamic button before click?

I'm trying to attach a jQuery plugin to a dynamically generated button. I've tried the following with no success: $('.myButton').live('click', function() { $(this).file().choose(function(e, input) { // ... }); }); I guess this doesn't work as the plugin needs binding before click. So I tried... $('.myButton').load(fu...

fireevent for mouse events in IE gets fired at different clientPoint

Hi, I am trying to fire a mouse event in IE at a particular coordinate. All the coordinates are set right before firing the event. But when the event gets fired, the client point gets changed and gets the value same as offset point. i.e., I created a mouse event with ClientPoint = (583,438) , offset= (585,481) and screen = (585,589). Th...

Mootools: How to Disallow `var drag` depending on `checkbox` checked?

Mootools: How to Allow and Disallow var drag depending on checkbox checked or not? window.addEvent('domready',function() { var z = 2; $$('#dragable').each(function(e) { var drag = new Drag.Move(e,{ grid: false, preventDefault: true, onStart: function() { e.setStyle('z-index',z++); } }); }); ...

Mootools: How to get `morpha.start()` after 2sec `mouseenter`?

Mootools: How to get morpha.start() after 2sec mouseenter? window.addEvent('domready',function() { var morph = new Fx.Morph('resize',{duration:700,delay:400}); $$('#resize').addEvent('mouseenter',function(e){ e.stop(); morpha.start({ width: '200px', height: '100px' }); }//It does not work on adding ',2000' he...

Mootools: How to Disallow `mouseenter` and `mouseleave` event when checkbox checked?

Mootools: How to disallow mouseenter and mouseleave event when checkbox checked? window.addEvent('domready',function() { var z = 2; var e = document.id('draggable'); var drag = new Drag.Move(e, { grid: false, preventDefault: true, onStart: function() { e.setStyle('z-index',z++); } ...

How do I add an onChange event to select tag in CakePHP?

I am trying to use AJAX to populate some select boxes that were autogenerated using CakePHP's formHelper. How do I add the onChange event listener to the select box? ...

How can you gain access to a web page's event listeners from a Google Chrome extension

I'm writing a Chrome extension to list out the source code for each event handler attached to an <a/> tag when you roll over it. Currently, I've printed out the href attribute - $(this).attr("href") - and this works fine. The source code is on github at http://github.com/grantyb/Google-Chrome-Link-URL-Extension. When I extend it to ac...

textbox should invoke button click event

I have a textbox and a button ,the button click event navigates to other location in the website i want to do the same thing on pressing enter key but unable to do that please helpme solve this my code snippet follows function call() { document.location= "location.aspx"; } <input type="text" id="txt1" onkeydown ="if(event.keyCode...

stopPropagate() is not working in FF

Hi, I did be glad if someone could help me solve this I have a user sign up page with username and password choice fields, I'm providing validation and availability asynchronously using event listeners, //username $("#username" ).bind('blur',function(e){ //ajax call if (e.target == e.currentTarget) { e.stopPropagation(); ...

Event notifications between iframe and parent

Hello - I am trying to send an event to iframes which have been opened by the application based on few events which should be prior registered by iframes. I cannot figure out how. I use jquery but I don't expect the iframes to be nice citizens to implement listeners in jQuery. Though I can mandate it - I am still looking for normal java...

onUnload event doesn't fire on refresh

I have an onUnload event handler in the body tag of my page. It calls a function which sends an Ajax request to the server. Everything functions when I navigate away from the page, but refreshing the page never sends a request to the server. One possible reason is that a refresh doesn't allow Ajax requests? does that make sense? Heres ...

Is there a way to mitigate downloading of resources (images/css and js files) with javascript?

I have a html page on my localhost - get_description.html. The snippet below is part of the code: <input type="text" id="url"/> <button id="get_description_button">Get description</button> <iframe id="description_container" src="#"/> When the button is clicked the src of the iframe is set to the url entered in the textbox. The pages...

Why parrents tabsshow-event triggerd by childtab?

I have a tab (called firsttab) with in his content another tab (called childtab). We bind the tabshow-event to the firsttab. if we click to one of the tabs in "firsttab" all work fine (Tab 1 - Tab 5) if we click to one of the "childtab" tabs (Tab 1.1 - Tab 1.3) the tabshow-event who are bind to the "firsttab" is triggerd. Testcase: ht...

Why bubling not working

I just want to understand how capturing and bubbling work. Unfortunately this code just work in IE, and not working in firefox. When i click on div3, it just stop there.it not bubling up toward body element. Can somebody enlighten me. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...

Javascript best practice - onclick vs unobstrusive

Hi, in our project currently i have the following problem. I have to bind some clicks to a list of elements locking like the following: <ul> <li class="listeelement" id="load-content-id-1"><div>listcontent</div></li> <li class="listeelement" id="load-content-id-2"><div>listcontent</div></li> <li class="listeelement" id="...

Issue: Onclick triggered after onblur on Mac machines

Hi, We have a couple of textboxes in a form. All of which are validated onblur. The form is submitted onclick of an anchor tag. <script> function validateMyText(){ // do field validation // if success return true; // else { alert("Please check the text box value"); return false; } } </script> <form name...

JQuery handling multiple key presses in IE and Firefox

Hi, I'm working on handling the multiple key presses with jQuery. I have two handlers: 1. keyDownHandler 2. keyUpHandler keyDownHandler detects if the certain key has been pressed, if yes it sets a certain boolean value to true and carries on with the processing. keyUpHandler resets the boolean value to false. All this is required...

Change background "onfocus" + other things

I have the script <input type="text" name="name" value="Joe Bloggs" onfocus="this.value=''"/> Just like I am doing with the onfocus="this.value…" can I change the background of the field (+ change other things?) Many thanks. Also, does anyone have a better idea of how to do the script above, but so that the text reappears when the d...