jquery-events

jQuery reversing animation on second click

I have a div element that on the click of a link slide in from the right and slides to the left, the works great, I am now trying to get so that if the link is clicked again it runs the animation in reverse, I have tried add a class to the link when the animation runs and then doing the same animation but backwards, but that does not wor...

jQuery.click(): Can I get a reference to the synthetic event object passed to event handlers?

I have an <a> inside a <TD>, and I'm trying to have clicks on the <TD>, but outside the <A>, act like they were clicks on the <a>. I'm almost there: HTML: <TD class="somethingPretty"> <a href="someURL" class="anchor">Text</a> </td> JS: $('.anchor').click(function(ev){return confirm("go ahead?");}); $('somethingPretty').click(fu...

jQuery: How to use event.preventDefault() with custom events?

How can I know in my triggering code that preventDefault had been called? $(document).trigger('customEvent', params); if (/* ??? */) doDefaultActions(); ...

jQuery live doesn't appear to bind click event.

The dynamically added links (classnames .divToggle and .removeDiv) only function if clicked twice the first time. What is preventing them from working properly right away? $(document).ready(function(){ // adds click event to links. $('a.divToggle').live('click', function(event) { // Toggles the visibility of divs. event.preventD...

Making an Ajax form from an Ajax request in jQuery

The client is making a request to the server. I need to take part of that request, and make the form button work with Ajax. This piece of code works perfectly for links: var pagination_render = function() { var pagination = $('.pagination a'); pagination.each(function() { $(this).click(function(event) { load...

how to rise hover event after some milisecond?

hello i create a menu and i show and hide submenu on jquery via hover event like follwing code is any way, submenu show or hide after some milisecond mouse stay over them? $(" #nav li").hover(function(){ $(this).find('ul:first').show(600); },function(){ $(this).find('ul:first').fadeOut(400); }); } t...

How distinguish refresh and close event using jQuery ?

Possible Duplicate: Is there a way in javascript to detect if the unload event is caused via a refresh, the back button, or closing the browser? Hi all I have the below set of code $(window).unload( function() { test(); }); the test() will call when i close the window and also if i refresh the window ..... How can ide...

jquery click event

Hi, I have a delete button on my web site which I want to add a confirm box to. I have wrote the following code in JQuery but I'm unsure how to continue with the page load if the user confirms the delete. e.g. what do I put inside the if statement to reverse the preventDefault? $(".delete").click(function(e){ e.preventDefa...

Event binding problem on select option (jquery)

I have a select with an option it with id 'option1'. option1 is the currently selected option on page load. In my $(document).ready, I have: $(document).ready(function() { $("#option1").click(function() { alert("Testing"); }); }); However, the alert is never shown and the event never fires! Is it not possible or s...

Bind event to a div appearing

Can I create an event so I can execute some javascript whenever an element with a specific ID becomes visible or appears on the page? The element comes from a remote resource (so isn't in MY html code but appears on page load) and I'd like some code to run when it appears (and only if it appears, it may not appear every load). Thanks! ...

Select list value undefined in $(document).ready

I have the following code, which I want to load values on a selection change, and also do the selection load initially (since FF 'saves' the last value of the drop down under certain circumstances). The select part of the function works correctly, but for some reason when calling load2 directly the value of $('#select1').value is unde...

Registering for jQuery(window).load(...) event, after the event has fired?

Hello, I am new to the group and just had a simple question about the jQuery(window).load(function() {});. I have an external JS file that gets inserted dynamically on the page "after" the window load event occurs. Inside this JS file I have a statement as follows: jQuery(window).load(function() { alert("Something"); }); The que...

Why is my jQuery event not being triggered when the button is clicked?

I am trying to call the .ajax() method when a button with id=go is clicked. This button is displayed when another jQuery event is triggered, namely that a button with a class called predicate is clicked. The button with id=go is displayed without any problems but on clicking it, there is no call to the alert() or getResults() method wh...

jQuery - events won't fire for dynamically created tab elements..

Hi, I am using jQuery UI Tabs. <div id="tabs"> <ul id="tablist"> <li><a href="#fragment-1"><span>One</span></a></li> </ul> </div> I have a button that adds new tabs. I use the following code: var newTabId = $('#tabs').tabs('option', 'selected') + 1; $('#tabs').tabs("add",'someUrl.htm','New Tab',newTabId); (Tab will be adde...

How to call regular JS function with params within jQuery ?

Is there another way to run a regular JS function with params passed than what I use below ? It seems redundant use a on-the-way function to do this. function regularJSfunc(param1,param2) { // do stuff } $(document).ready(function(){ $('#myId').change(function(){ regularJSfunc('data1','data2'); }); } Using a .bind event ...

jQuery UI draggable() and resizable()

I want to write the draggable() and resizable() code in such a way that all future elements with a particular class will inherit those plugins without calling them again. $('div.resizeMe').resizable({ containment: 'parent', minWidth: 400, minHeight: 200 }) When the above code is executed, all divs with resizeMe class inherits the resi...

jQuery event.stopPropagation is not working on <a>

I have the following javascript: $('#ge-display').click(function (event) { window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no'); event.stopPropagation(); return false; }); the element with id 'ge-display' is a standard link: <a href="/goo...

jquery change event not working with IE6

It is indeed quite unfortunate that my client still uses IE6. using jquery 1.4.2 The problem is that I open a window using a click event and do some edit operation in the new window. I have a 'change' event attached to the row of a table which has input fields. Now when the window loads for the first time and I make a change in the inpu...

jQuery onkeyup event in textarea that does not fires when nothing change.

I was thinking to a function that check the key value pressed, and accept only the most common characters, canc, enter, ... because i need it only for basic ascii character set (not ñ, č, chinese chars, ...). Or function that after every keyup checks if value has changed. But really jQuery doesn't have an event handler for this situati...

jQuery live() and stopPropagation() issue

I know that the live() event handles event bubbling different than all other jQuery events. jQuery recommends using 'return false', but in my case that doesn't work. The issue is: I have a DIV which contains an anchor tag. The DIV is bound using live(). Whenever I click the anchor tag inside this DIV it bubbles and calls the DIV's e...