javascript-events

select box behaviour in IE

<title>Sample</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript" src="jquery-1.4.2.min.js"> </script> </head> <body> <select onchange="alert('hi')"> <option value="0" selected="selected">Option1</option> <option value="1">Option1</option> <option value="2">Op...

Trigger a link in adjoining table cell using jQuery

I have an HTML table where the first cell of each row contains text and the second cell contains a link. Like so: <table id="foo"> <tr> <td>Some text</td> <td><a href="/path/to/file/"><img src="/path/to/image.jpg" /></a></td> </tr> ... </table> I have a hover effect on the first table cell and when a user clicks on the f...

How to open the homepage in FULLSCREEN with javascript without opening a new window ??

How to open the homepage in FULLSCREEN with javascript without opening a new window ?? ...

Why doesn't this event unbind using jQuery?

I have seen similar questions but I can't figure out what I am doing wrong here. The dropdown is shown after an ajax call completes succesfully then I want to hide it when a user clicks anywhere. I would like to remove the event though because there is no need to hide it if it is already hidden. dropDown.slideDown('fast'); ...

How to open a new window in FULLSCREEN with javascript ??

I am using this code but it doesn't work because the new window is half of the my screen ( 1280x800px ): <a href="javascript:void(0);" onClick="window.open('http://www.stackoverflow.com', '', 'fullscreen=yes');">Open Full Screen Window</a> Why ? ...

Pressing Escape under Firefox kills my Ajax requests. I'd like to prevent this.

Dear Stackers, I'm developing a web application which requires long-running Ajax requests. Unfortunately, under Firefox, pressing Escape during a request has the drawback of killing the request and any information it was holding. This is rather annoying, as this can lead to all sorts of nasty complications if this happens at the wrong t...

Possible preventing repaint when dynamically inserting script?

Hey, As I've understood the browser will freeze all DOM rendering when it sees a script tag and only continues once it has processed it. When I inserted an external javascript file (typekit) directly in the HTML this seemed to be the case, but now that I'm including it dynamically it causes a repaint of the window. Is it possible fixing...

Cross-browser JS inconsistencies

I have a PHP script that allows image upload. I modified it slightly to load newly uploaded image into a modal window in order to allow manual crop, if needed. It seems I got it working in FireFox (all the way until actual crop). IE throws an error: "Object does not support this property or method" and Opera just chokes and does not k...

jQuery event listener for when text has changed in a <td> cell?

Is there any way in jQuery to attach a listener to a cell so that when the text inside the cell has changed (by JavaScript, not the user), the event is triggered? ...

The best way to bind event on a cell element

Hello, I've a webpage fullfilled by a JS script that creates a lot of HTML tables. Number of <table> created can vary between 1 and 1000 with 100 cells in each of it. My question is : how to bind efficiently the click on theses tables? Should I bind the click on each cell of the <table> or directly to the <table> itself and retrieve t...

onpopstate event doesn't trigger in Chrome/Safari

Chrome and Safari doesn't trigger the HTML5 onpopstate event. Here is my example: <!doctype html> <html> <head> <title></title> <script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; <script> window.onpopstate = function(e) { document.getElementById("log").i...

java script Validation related to checkbox and textbox in a gridview

hi, i have a situation where i have to halt a program and for this i need to provide the halt reason.I have a gridview where i can select multiple items by checkbox.i need a java script which will validate that halt reason text box has some text while i click the halt button to halt the selected items.Here is my gridview <asp:GridView ...

Debugging issues : detect where my focus is with jQuery ?

Forcing focus() on an element is easy, but after having debug issues, I realize trying to determine where is my focus gone is a lot harder. thing is I'm generating a modal window using jq.UI, and from time to time, while focus is supposed to be set on first input of the form inckuded in the modal, cursor just disappears, to never show ag...

How to trigger CTRL+C Keyevent width Jquery?

Hi, I want to simulate a ctrl+c to copy the text into it. I first tried this: $('#codetext').click( function() { $("#codetext").trigger({ type: 'keydown', which: 99 }); } HTML: <input type='text' id='codetext'> I have also tried using $(this) instead of the selector, but the input element also has focus on it, does...

Defer javascript execution till the content has been added to Document

I am trying to load some content into a page using Ajax. The html that is loaded contains some javascript code. Even though the code is wrapped within $(document).ready, it gets executed before the content is inserted into the document, because the parent document's Dom is ready by the time the content is loaded. How can I defer the exe...

How to handle single JavaScript events intuitively?

Hi, I often need to create single events that are not needed after they have run once. The way I do is something like: A.prototype.someMethod = function () { var me = this; this.onWindowMouseUpFunction = function () { me.onWindowMouseUp.apply(me, arguments); }; window.addEventListener('mouseup', this.onWindowMou...

How to capture mac's command key via javascript?

So, that's the question =) How to capture mac's command key via javascript? ...

trigger js function from inside another in an anchor tag

var game = (function() { function start() { //somefunction } function save_count(someparamt) { //somefunction } })(); How could I trigger savecount() from the browser url? javascript:savecount(); won't work and neither game.savecount() and neither window.game.savecount(); ...

Capturing multiples keystrokes in javascript.

I'm trying to do a javascript application that needs this particular feature: Whenever the user presses one of the arrow keys, it must act acording to the key direction. And if the user press a key, hold it down, and press a second one, then, only the action of the seccond one must be executed until released. And if the first one stil...

how to add an eventListener to an Object in javascript which will fire when object is manipulated?

Hi, I have a complicated UI structure which is manipulated dynamically, and say I have an ui_state object where i keep user's latest UI states such as which tab was visible, what was inside that tab etc. For instance: var ui_states = { tabs : [ { name : "some tab", active : true, children : { ... } }...