jquery-events

Order of change/keydown/keypress events in jQuery

I have been investigating event fire order between browsers, because our application is experiencing some unusual behaviour. I have created a little test to see the order of the three events: change, keydown, and keypress. Here is the HTML (test.html): <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/...

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(...

jquery mouse position relative window

Hi Guys, I'm trying to get the exact mouse position relative to the window. Here is my issue... document.height = 1600 (actual document size) window.height = 400 (viewable) I need to figure out the mouse position relative to the window, not to the document which the pageY attribute provides. It's for a large tooltip, which gets ...

jQuery handle Ajax timeout?

Hi, I'm trying to catch Ajax timeout error with jQuery 1.4.2, but none of tutorial I found work. In Firebug, when timeout error fires. I see uncaught exception: [object Object]. Please help me handle Ajax timeout. Here's my JS code: $.ajax({ type:"POST", url:"/data/add/", data: { "date":$("input#date").val(); },...

What's a better method for triggering a load() event on cached images?

I'm working on a script that waits for content to load in a hidden div before activating a thumbnail that points to it. $('#preload img:first-child') .bind('load',activateThumb) .each(function(){ if(this.complete || this.complete===undefined) $(this).load()}); The each part triggers the load() event for images in the cache. I ha...

checkbox value when calling the method 'trigger' with click event

How can I can I get the correct current value in the click event to call via a trigger? Html: <input type="checkbox" id="mycheck" /> <br /> <span id="actual-value-inevent"></span> <br /> <span id="actual-value"></span> <br /> <button id="view-value">view value</button> <br /> <button id="call-trigger">call trigger</button> <br /> <butt...

how do i implement a jquery background messages?

for example when you get a new badge on stack overflow, you get the notifaction message on the top, telling you have a new badge, it deos that on the backgroung!! is thier a toturial or article that can help me with this kind eventing updates!! ...

jQuery tabs, dynamically binding to click event on currently selected tab

I'm trying to bind to the click event of the currently selected tab with jQuery tabs. I'm dynamically creating tabs so I need to do live binding. The idea is that I want to reload the current tab if it's clicked on again. I tried binding in the select event, but it seems this event doesn't fire for click on the already selected tab. I ...

touchmove events

I am using mousemove events to change the background color of the text $("span").mousemove(function(){ $(this).css("background-color","yellow"); }); but when I tried it with touchmove event for iPhone application, it was highlighting the first span tag, but not sequentially. ...

What is the difference between .click(...) and .live('click', ...) ?

Consider the following code: HTML: <div id='button' class='enabled'>Press here</div> <div id='log'></div> CSS: #button { width: 65px; height: 25px; background-color: #555; color: red; padding: 10px 20px; } #button.enabled { color: #333; } #button.enabled:hover { color: #FFF; cursor: pointer; } JavaS...

prevent queued events from being executed in jquery

I have a handler which is triggered for two events: blur trigger of object A. click on object B. The problem is when Object A has focus and I click on B, both the events are triggered. I want to stop this from happening. The handler should be executed only once in this case because there's a toggle() inside which is being nullified d...

What is the difference between clicking a checkbox and calling its '.click()' function ?

Consider the following code: HTML: <input type='checkbox' /> <div>Click here</div> JS: $(function() { $('input').click(function() { document.write($(this).is(':checked') ? "checked" : "unckecked"); }); $('div').click(function() { $('input').click(); }); }); When the checkbox is clicked, the output i...

jquery.Event of dynamic elements.

my code and my problem is: <script type="text/javascript"> $(document).ready(function() { // this variable is used to set the dynamic elements tagFlag = ''; $("#a1").click(function(event) { event.preventDefault(); tagFlag = 'me'; // setting the element which I want to trigger later }); $('#'+tagFlag).click(funct...

What is the argument for?

$(document).ready(function(){ $('#something ul a').click(function(e) { ... ... e.preventDefault(); }) }); what is the e for and the e.preventDefault mean so i can understand what is happening here ...

jquery - Hide #test if anything else than #test or its children is clicked?

The title sums it up. I simply want to hide #test when anything else than #test or its children is clicked. Thanks a bunch! ...

Listen for change of class in jquery

Is there a way in jquery to listen for a change to a node's class and then take some action on it if the class changes to a specific class? Specifically, I'm using the jquery tools tabs plugin with the slideshow and as the slideshow is playing, I need to be able to detect when the focus is on a particular tab/anchor so that I can unhide ...

increase a hidden input's value based on click of button

I have a hidden input #start thats value is used to display a range of returned data (it is the starting point of an index) each time you click #next I need to increase its value. $("#next").click(function() { $("#start").val() + 80; )}; is this correct? or is there a better way? thx all! ...

toggle a css color on hover

I am trying to add a highlight color to a class like this $(".common_box").hover(function(){ $(".common_box").addClass("hover_me"); }); this works but why doesnt this $(".common_box").hover(function(){ $(".common_box").toggleClass("hover_me"); }); when i hover over this nothing happens is there no u...

jquery bind/click vs document.onclick - bind callback is called multiple times

Hi, I have a button named okbutton. A callback function is bind to the click event of the okbutton during page load $('#okbuttonid').bind('click',function() { alert('here'); }) The first time i click the okbutton it alerts once. as expected. When i click the next time it alerts twice and for the third time it alert thrice and it go...

hover event problem with jquery

hi all im building a menu and im trying to put an hover effect on each menu item but... when i hover everything is working great and i get the html i want and the menu item has a backgruond image. but the unhover effect dosnt fire most of the times. i found out that if i move my mouse horziantly across the ul menu it works fine. but if ...