JQuery :: Events - Live -v- Livequery
May 18, 2009I normally do this with livequery:
So any new .mylink's on a page would also be bound with my custom function.
How can I do this with the new LIVE event? or is it even possible?
I normally do this with livequery:
So any new .mylink's on a page would also be bound with my custom function.
How can I do this with the new LIVE event? or is it even possible?
I've used nice livequery plugin for many things, not just for binding events. Now when jquery1.4.2 is out it seems like it is time to replace $.livequery() with new .delegate() or even .live(), but browser events like (ready) does not work. Am I using the incorrect event (with delegate)? For example I am using livequery:
$('ul.fileList li').livequery(function(){
var oi =$(this);
// DOM manipulation, appending menus and attaching plugins and so on
[code].....
I have this filter in a results table that also reflect in a ui datepicker day styling (ex:available unavailable) . Everything fine till i change month or year in datepicker . Maybe i have to use live() or livequery() but can see the way .This is the code:
$("#filterSelect").change(function(){
var filtro=$("#filterSelect").val();
$("#filter-box2").val(filtro);
[code]....
I am finding that remove() does not remove live events. I'm wondering why this is. I've also noticed that the selector for .die() has to be specificand I can not simply do $("*").die().Is there a reason for this? I found that if I use delegate instead of live then it does get detached. I'd like to understand this since it's causing double/triple event triggering in my pages.
View 2 Replies View RelatedI am trying to accomplish something like this:
<p>
text <a>link</a>
</p>
----
$("p").live("click", ... something cool...);
$("p a").live("click", function(e){e.stopPropagation();});
//so the link is still followed but the click event on the P is not triggered.
This fails since live events bubble differently than bound events. So, what I have to do instead is $("p a").live("click", function(e){return false;}); but then the link is not followed. So, I do $("p a").live("click", function(e) location.href=this.href; return false;}); but then "open in new window" doesn't function correctly. Is there a good way to overcome this limitation/behavior?
Following code works.
$('#container a').bind('click', function(e){
log( $(this).text() + ' clicked1');
return false;
});
[Code].....
I've come across an issue where I've got a dynamically created popup class that despite appearing to be bound according to Visual Event does not fire on clicking the closebutton attached to it. I'm not getting any errors in firebug and by setting breakpoints I've verified we are not reaching the code to execute. Ruling out the usual suspects such as obvious spelling mistakes/ swapping out jquery versions 1.3/1.4/1.5 doesn't make any difference.where else I can look?Here is the original function:
$this.find(".close").live('click', function() {
var $this = $(this);
$this.parents("." + sets.popupClass).remove();
[code]....
I am looking for a way to simulate the actions of the hover (or mouseenter/mouseleave) whilst using the live method of binding (The items are dynamic). Is there a way to do this or will I need to use the 'old fashioned' method of unbinding and rebinding? I do not want to use a plugin.
View 6 Replies View RelatedI use the live - method to bind a handler to a click-event for all links with class "userDiv"
When I DON'T use this and use instead the "normal" click handler
I can still use the middle Mouse-Button in Firefox to open the link in a new tab without any jquery-stuff
But when I use the live-method (and it would be nice to use it) the middle Mouse-Button behaves like the left one.
I've been working on this for quite a while trying to figure out why I can only get a click to be recognized by IE once. If a user clicks on another element, and then goes back to the original one, nothing happens. I've gone right down to this
<code>
jQuery("ul.showList li.show div.showData, ul.myShowsList li.show
div.showData, ul.myFriendsShowsList li.show div.showData,
div#popForecast li.show div.showData, div#gigList li.show
[code]...
I have a page that contains images, and those images are displayed in a fancybox window when they are clicked. Some of these images are loaded dynamically after the page loads via AJAX.
All of the images exist inside of link tags with class="challenge_image_gallery". The code works the way it should on the images that are initially loaded on the page. However, when the new images are loaded onto the page using AJAX, the fancybox window loads two instances of the image that was clicked on rather than one as it should.
Here's the code I'm using:
It's time for me to upgrade a significantly complex site to the latest jquery hopefully jq 1.4.2.
This code has been working well (for nearly 2 years and probably not the most optimal) on jquery 1.2.6 + livequery + jquery.forms. Trying to find the best way to port this to the jquery 1.4.2.
Not sure whether to try live() or delegate(), but would like to make sure I get good browser coverage.
I'm currently using h5validate with my forms but recently setup a few where a second form is generated based on what a user selects from a dropdown menu (via AJAX). Since the new form ID's were not existing when the document was loaded jQuery does not bind h5validate to the new form. I found a plugin called livequery that will bind new elements on the fly. Unfortunately, I'm pretty new to jQuery and can't quite figure out how to make this work with h5.
My current h5 function looks like this, where formID is the ID of the from that does not exist but is later loaded in via AJAX.
Here are the sites to the two plugins:
I am trying to "ajaxify" my site. Now I have one problem:
$("#posts").children().remove();
$("#tag-sidebar").children().remove();
$.each(data.Tags_Sidebar, function (indexInArray, valueOfElement) {
var insert = $("<li>");
[Code]......
Now when I click one of those links (href1, href2, href3) generated, the click event won't execute! What's the problem? Also, is it right that I have to transfer the valueOfElement over, like I did? What does stopEventPropagation do? Prevent the href from being navigated to? That's what I am trying to do.
The data object is JSON fed from here:[URL]
The HTML is here: [URL]
I have a series of images with an animation bound to mouseover and mouseleave events, and I'm trying to get my head around adding a click event that would prevent the mouseleave animation from occurring only for the image that was clicked, preserving everything else as is (until another image is clicked). I've discovered .stop() and I think I'm getting close, but some part of the logic is still escaping me.
View 3 Replies View RelatedI've got 2 pages: a current events page and a past events page the current events page loads fine as there is only about 10 events the past events page takes about 30 seconds to load and will crash if u click your mouse in the loading time.
The pages are near identical the only difference is the query that selects the events (> versus <)
The page loads immediately without:
But when i put it back in the above happens. I'm using jQuery.roundedcorners.
I have a function that I apply to every anchor tag in a div called listnav. I do so like this:
$('.listnav a').each(function(i, el) {
$(el).click(function(ev) {
ev.preventDefault();
var href = $(this).attr('href');
[Code]....
This,among other things, causes a function called load to be called on the href of the anchor. This works fine. Howver I want to use the live() function with this as I am going to dynamically change the links in the listnav div. I tried doing it like this :
$('.listnav a').each(function(i, el) {
$(el).live('click',function(ev) {
ev.preventDefault();
[Code]....
But that does not work. My question is how would I go about changing this function so that the actions are applied to any new anchors added to the div dynamically?
I am exhausted today, not to include the funk that the BCS national championship put me in, so I must be either crazy or missing something. When I do the following the code works;
[Code]...
how to toggle between functions, however I because I am reloading the element that contains the checkbox I am clicking, I need to use the live function (I think).
I have used live before and it works great for clicks, but can I use it with toggle.
frist of all, im a newbe on jquery. i have a table where i can add new "<span>" and i can edit it with editInPlace plugin but i have a problem. when i load the web with those elements (<span>), i cant edit it after i add a new item, then, all the items are editable
[Code]...
how I can execute this 'function(dateStr, inst)' . The jQuery partially works it divert to another page but without parameters, the outcome displays [object Object].
Code:
$.noConflict();
jQuery(function() {
jQuery('#datepicker').datepicker({
[Code]....
I am using a delayedObserver which works great, but I can't figure out how to use it when the field I am binding is loaded via ajax. So ideally, something like this:
$('[data-live_form_field]').live
.delayedObserver(0.35, function(value, element){
$(this).parents('form:first').submit();
});
This would bind any form elements with the live_form_field data attribute to the observer and submit the form. The code doesn't work though since that isn't the right syntax for the .live method.
So I have a set of <SELECT> elements that are ajax'd in and out depending on what is selected using the event "change". I know that .live("change") is not fully supported.
View 2 Replies View RelatedThis is my Html: I am trying to get the element that I binded to live(), but always i am getting it's children. For example, this is my code:
<div id=div1 class=theClass><b>Hye</b></div>
<div id=div2 class=theClass>Hello
</div>
[Code].....
I am trying to:
$('.entity_id').live(
'mouseover mouseout' , function(event){
if (event.type == 'mouseover') {
console.log('mouseIn entityID', $(this).attr('client'))
$(this).css('color: red;')
} else {
[Code]...
this is supposed to work whenever:
[Code]...
is in the dialog box, the logs are working, but the css color changes are not.
I have this in my jQuery() function:
$( "#admin_new_records ul a" ).live( "tap", function() {
jQT.goTo( "#admin_new_records" );
return false;
});
I create the links that match this on the fly with jquery.builder.js, and have confirmed that searching the resultant DOM in the console with the string "#admin_new_records ul a" does indeed return the elements I want. The problem is that when I click on the links, the jqt framework still seems to handle the tap, and returns to the first screen with an error due to the fact that it cannot recognise the url I created for the links. The issue seems to be that live does not work, but I have also tried to set this on tap() immediately after creating and appending the links, and this does not work, either.