javascript-events

how to change behavior of contenteditable blocks after on enter pressed in various browsers

When pressing enter in <div contenteditable="true"> </div> in firefox <br /> is produced - that's ok. But in Chrome or IE a new <div> or <p> is created. What should I do to make Chrome and IE behave like Firefox . ...

What does addListener do in node.js?

I am trying to understand the purpose of addListener in node.js. Can someone explain please? Thanks! A simple example would be: var tcp = require('tcp'); var server = tcp.createServer(function (socket) { socket.setEncoding("utf8"); socket.addListener("connect", function () { socket.write("hello\r\n"); }); socket.addListener(...

JQuery: how to use "delegate" instead of "live"?

I've read countless articles how using the JQuery delegate is much more efficient than using the "live" event. As such, I'm having trouble converting my existing Live code to using Delegate. $("#tabs li:eq(0)").live('click',function(){ //...code }); $('#A > div.listing, #B > div.listing, #C > div.listing').live('mouseover',function(){ ...

Clone a node using Javascript DOM

I want to create a clone for below code using javascript DOM var summaryDiv = __createElement("div","sDiv","sDiv"+j); summaryDiv.onmouseover = function() {this.setAttribute("style","text-decoration:underline;cursor:pointer;");} summaryDiv.onmouseout = function() {this.setAttribute("style","text-decoration:none;");} ...

button onclick not working

I have a javascript where I need to hide (and eventually show) some text by clicking a button. However, when I click the button, it does not call the function specified in the onclick parameter, and so nothing happens. Here is my source code: <script type="text/javascript"> $(document).ready(function(){ ...

unable to trigger event in IE during cloning

Following is the code which will clone a set of div with their events(onclick) which is working fine for FF but in case of IE it is not firing events associated with each div. <html> <head> <style type='text/css'> .firstdiv{ border:1px solid red; } </style> <script language="JavaScript"> function sho...

How can I pass checkbox onclick event to parent onclick ?

I a with an onclick event and , and inside it. When I click on the checkbox then the div-onclick event doesnt fire - I would like it to fire without having to dublicate the onclick onto the checkbox. <div id="id-tag" onclick="do()"> <span>text</span> <img src="pic.jpg" /> <input type="checkbox" name="mycheck" /> </div> I know...

window.focus() not working in Google Chrome

Hey folks, Just wondering if Google Chrome is going to support window.focus() at some point. When I mean support, I mean have it work. The call to it doesn't fail, it just doesn't do anything. All other major browsers do not have this problem: FireFox, IE6-IE8 and Safari. I have a client-side class for managing browser windows. When I ...

.focus() doesn't work on an input while orher attributes works

I have a classic table / thead / tbody structure, which I add a line at the end of the tbody. The line contains only an input element. The code works in Firefox 3.6 but not in Chrome v5 or IE8. I'm using jQuery 1.4.2. Does not work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').focus(); Does work: $("#" + AJAX_ID)...

Fire an event when the innerHTML of a <div> changes. In YUI or otherwise

Is it possible to fire an event when the innerHTML of a changes? I am using YUI 3. Thanks! ...

Is there anyway to prevent onbeforeunload event from triggering when using internet explorer

I have a function that is suppose to trigger when user closes their browser and I have put the code in the "window.onbeforeunload" function. The thing is every time if I reloads the page in Internet Explorer, the onbeforeunload event will also trigger which is a problem because I only wants it to trigger only when the user closes or na...

How to get the textbox value in php?

On my page. i have one textbox and one button. -- on the button click event. -- one function will be called. Now, How to get that value of textbox and store in php variable? this should be done in that function which we will call on button click. ...

How to call a javascript function of parent window when child is closed?

Hello All, I am creating a pop up window. After I am finished with the work on child(pop up) window and click close button, i need to call a javascript function of the parent window. How can I achieve this. I am not creating the child window myself but displaying the contents of some other url. ...

Ensuring load code fires in jQuery event if attaching event after load occurs

I'm trying to figure out how I can best attach a load event to an element, but be sure that it gets run. The issue comes when I bind to the load event of an img, but that binding happens too late and the image has already loaded. Is there some way in jQuery to check if the image is already loaded? Its obviously an intermittent issue, ...

another onmouseover problem this one concerns pictures

Hi all! have problems with mouseover in Mozilla and Chrome after making it work in IE, for sure I can tell you that my code woked perfectly in Chrome at least, cause thats my default browser and I used it for debuging when creating the javascipt and it worked nicely... until I tried to make it work in IE too. Here I post the full code o...

Javascript timers

I'm starting on a javascript MMORPG that will actually work smoothly. Currently, I created a demo to prove that I can move characters around and have them chat with each other, as well as see eachother move around live. http://set.rentfox.net/ Now Javascript timers are something I have not used extensively, but from what I know, corr...

Click event not registering on second page.

I'm using tablesorter and tablesorter.pager. Here is my code. $(document).ready(function() { $("#peopletable") .tablesorter({ widthFixed: true, widgets: ['zebra'] }) .tablesorterFilter({ filterContainer: $("#people-filter-box"), filterClearContainer: $("#people-filter-clear-button"), filterColumn...

Issue with DOM manipulation (blockUI or alert()) during a onchange request - prevents other event from firing.

EDIT: I wrongly assumed this was caused by blockUI(); I was using Firebug's console.log to log the message but for the example here I changed to alert so you wouldn't need firebug to replicate. Once I tested it again, I was able to remove blockUI and the onclick didn't fire not firing. The issue seems to be whenever the DOM is changing...

How can I set the order of events in Prototype?

I need to be able to set the order of event handlers for a click event using Prototype. I need to insert an "Are you sure?" pop-up before an Ajax call modifies data. Due to the way the program is structured, I can't change the order of js click bindings. I love jQuery and there's an elegant solution to this problem right here on Stack...

Is there a way to use javascript to check if a button has been clicked

Hi all, I'm just curious if there is a simple way to do this, something along these lines javascript: if(document.getElementById('button').clicked == true) { alert("button was clicked"); } html: <input id="button" type="submit" name="button" value="enter"/> Thank You Ruth ...