[jQuery] if button clicked then do this else do that
Hello, I am trying to do something like this. if a button is clicked call one function $('.saveButton').click(function(){ call one function }); else call another function. But I don't have any idea how to implement if else in a clicked event. Can any one help me?
[jQuery] everthing works but has this jquery error
this.parentNode is null init()()jquery-12.min.js (line 12) init()()jquery-12.min.js (line 12) init()()jquery-12.min.js (line 12) (?)()()editInPl...jquery.js (line 40) F()()jquery-12.min.js (line 19) F()()jquery-12.min.js (line 19) F()()jquery-12.min.js (line 19) init()()jquery-12.min.js (line 12) c()jquery-12.min.js (line 19) F()()jquery-12.min.js (line 19) F()()jquery-12.min.js (line 19) [Break on this error] (function(){var l=this,g,y=l.jQuery,p=l.each (function(){o.dequeue(this,E)})}}); I have made a edit in place form and when ever i click any element i get this error but all the functions are working just perfect. Can any one say me what is causing this error message to show up. Prompt reply will be appreciated. Sanam
[jQuery] problem with removeClass() or live() event
Hello, I have dynamically adding and removing element function within live () event and used addClass() and removeClass() to update the classes of the remaining elements. It works all fine and shows the updated classes when checked in firebug. But when alerting the class it shows both new and the old class.Can anyone help through this problem. $('a.remove').live("mouseover", function(){ $('a.remove').each(function(i) { remove(this, i); }); }); function remove(obj, i) { //remove the clicked element and update the classes of the remaining elements .remoceClass().addClass(newclass) }
[jQuery] Re: Live() event doesnot refresh the class of the event which was changed dynamically.
Hello, Thanks for the prompt reply. Yes I have used the newclass and tried. But the problem remains same. I think I have figured out the effecting place. I have used the jeditable plugin for the editable as follows. $('.plus'+num).live("mouseover", function(){ $('.plus'+num).editable(' http://localhost/editinplace0/save.php?p=add'+num,{ submit : '', indicator : '', tooltip : 'Click to edit...', style : 'display: inline', width : '100px', onblur :'submit' }); }); Here* '.plus'+num* is the new class where *num* is a variable to make every class different. And i have passed 'p=add'+num by get method for the reference address to store the changed data. eg. if .plus1 is edited then it goes and saves in add1, if plus2 then num2 and so on. Now the problem is that once i have moved the mouse over all the dynamically added elements and delete one element, even though the class has changed automatically, the value i had passed by $_GET method doesnot change. suppose i have deleted plus2 after i have moved mouse over all the existing elements, *old class old reference new class new reference* plus1 add1 plus1 add1 plus2 add2 plus2 *add3* plus3 add3 plus3 * add3* plus4 add4 Now here the class has changed from plus4 to plus3 but the reference the i have send through $_GET method doesnot update. What is causing this this problem? Hoping for the prompt reply. Sanam. On Sun, Jul 5, 2009 at 10:47 PM, Josh Powell wrote: > > Also, be very, very careful with using mouseover, mouseout, or > mousemove with live events. The way live events work is to put an > event handler on the document and catch events as they bubble up and > check them against the selector. So, when using mouseover live > events, you are executing a comparison against the selector every time > the mouse moves over an element on the page. This can cause some > dramatic slowdowns, especially if you are using multiple live events > of these types. It's often better to use regular events for > mouseover, mouseout, and mousemove. > > Josh Powell > > On Jul 5, 9:21 am, Nic Hubbard wrote: > > Pretty sure that you have to create a new .live() event for your > > expected class. So, you would need to do: > > > > $(".newClass").live("mouseover", function(){ > > //clickable function here.. > > > > }); > > > > On Jul 5, 12:30 am, Sanam wrote: > > > > > Hello, > > > I got this problem with live() event.I have used it as follows. > > > > > $(".addressDiv span").live("mouseover", function(){ > > > //clickable function here.. > > > > > > }); > > > > > I have used the live() event to trigger the function on mouseover in > > > the dynamically added elements. But the problem i got is that once the > > > live event is called it takes the class of the element and stores. And > > > when the class of that particular element is changed dynamically the > > > live() event does not detect the new classed added dynamically, > > > instead it takes the former class. Live() event does not update the > > > class. How can I solve this problem? > > > > > Sanam >
[jQuery] Re: live event doesn't work after append()
i think i am having the similar problem as yours. I have used live to make clickable the dynamically added elements as below. $(".addressDiv span").live("mouseover", function(){ //clickable function here.. }); But the problem is that once the dynamically added elements are activated by the live event, it now stores the attributes of the elements. Now even after the elements' attributes are changed the live event doesnot refresh its stored attributes and instead takes the previous ones. Is this live() event's error or I am using it in a wrong way. Can anyone help me in this? Sanam On Jun 29, 3:08 pm, Anton wrote: > I found the bug ticket with similar problem:http://dev.jquery.com/ticket/4762, > but it was closed as invalid. The problem still exists for me. > > I have the followingliveevent: > $("a:not([onclick])").live('click', ajaxLinkHandler); > > It's not applying to content loaded via $.ajax(...).responseXML which > I used to append in the following way: > // withing ajaxLinkHandler > var content = $(loadedDocument).find("[component='"+ id +"']"); > $(this.contentContainer).empty().append(content);
[jQuery] Live() event doesnot refresh the class of the event which was changed dynamically.
Hello, I got this problem with live() event.I have used it as follows. $(".addressDiv span").live("mouseover", function(){ //clickable function here.. }); I have used the live() event to trigger the function on mouseover in the dynamically added elements. But the problem i got is that once the live event is called it takes the class of the element and stores. And when the class of that particular element is changed dynamically the live() event does not detect the new classed added dynamically, instead it takes the former class. Live() event does not update the class. How can I solve this problem? Sanam
[jQuery] Firebug shows the updated class of an element but live() function takes the old class,Why?
Hello, I am new to this discussion but hope you would post reply for my query and encourage me to keep in touch with this discussion. Well here is my problem. I have made an edit in place form in which we can add and remove the elements. I have used jquery.jeditable.mini.js and jquery.duplicate-remove.js plugins for edit in place and add and remove action. I have live() function to access the dynamically ganerated elements like this. $(".addressDiv span").live("mouseover", function(){ clickable function here.. }); Every thing looks fine untill i try to send the data to the database of the dynamicaly added element that has moved a place up after its preceding element was deleted. Now this sends the data to the to the old class reference. $("div:gt("+p+")").each(function(){ $("div:eq("+n+")").find('span').removeClass('plus'+m).addClass ('plus'+num); I have used this to update the classes. Hope to get the reply. Sanam Maharjan.
[jQuery] Re: Firebug shows the updated class of an element but live() function takes the old class,Why?
Hello, I think i have found the problem place but still cannot solve it. $(".addressDiv span").live("mouseover", function(){ > //clickable function here.. > > }); > I have used the live() event to trigger the function on mouseover in the dynamically added elements. But the problem i got is that once the live event is called it takes the class of the element and stores. And when the class of that particular element is changed dynamically the live(event does not detect the new calssed added dynamically, instead it takes the former class. Live() event does not update the class. How can I solve this problem? > > Hope to get the reply. > Sanam Maharjan. >