[jQuery] Re: superfish navbar issue in Afterburner or JA-Purity Templates
Thanks Charlie, You describe the situation perfectly! I am still a tenderfoot at this game but I am getting my hands dirty. Priorities is not the easiest notion to grasp. I am using Firebug but I am not yet fully proficient with all its functionalities and haven't (yet) got the method to move up a trail of cascading styles. At this stage, my menu is working with the mods I indicated. I will fine-tune it once the new site is up. You'll be told! On Nov 26, 2:58 pm, Charlie charlie...@gmail.com wrote: what you are discovering is the root of most problems installing one menu in any template with an existing menu will run into css conflicts. The majority of the issues that pop up in this group regarding superfish stem from Joomla installs and the exact situation you are running into Without using DOM inspectors like Firebug it is almost completely trial and error trying to figure out which rules take precedence for each element or pseudo class ( like hover). if you haven't already done so install Firebug and you will be able to quickly see the inherited rules for each part of the menu xantof wrote:This is a progress report on finding a solution : If all CSS pertaining to the NAV position in the Template's style sheet are commented out, then it works. This is a dirty solution and I would like to find the root of the problem. I think it has to do, at least in part with the WIDTH parameter. I am progressing with learning CSS, understanding JQuery and overall trying to figure out how all those files interact to give out the web page I want. I still find it hard to follow CSS priorities across the different stylesheet and identifying the proper Class to modify. This is where I was hoping to get help. Keep you all posted.
[jQuery] Widgets giving problem in master page
Hi everyone, I am using Jquery for moving widgets in a page.By using (http://nettuts.s3.amazonaws.com/127_iNETTUTS/demo/index.html ) site i done it.it is working fine in normal page.I am using in master page(asp.net). when widgets placing one bye one the page height is increasing .I placed widgets in content page .when placing widgets one bye instead of content page .the background page is increasing.it is not good to see http://old.nabble.com/file/p26635807/dragissuein%2Bjquery.jpeg Could any help me to solve this issue Thanks Regards uday kumar -- View this message in context: http://old.nabble.com/Widgets-giving-problem-in-master-page-tp26635807s27240p26635807.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Selector issue
Well, after a few tests, this works fine : $(#cat_list div).live(click, function() { alert($(this).attr(id)); }); thanx
Re: [jQuery] Re: next()
That's easy, .next() finds the nearer next *sibling* of current element matching the selector. In your case, your element is not current element's sibling, it's under another node altogether. div span class=mehey, it's me !!/span spanand I'm his sibling/span aand I am too/a p spanthough I am not because I'm not the direct child of the same direct parent/span /p /div div aneither am I, I'm also in another parent, the fact that I'm on the same indentation level is not enough to make me directly related to this span.me guy/a /div Hope it helps. Michel Belleville 2009/12/4 TMNT tmand...@gmail.com Thank you jpcozart. here's part of my html: div class=form-item id=edit-question-900-wrapper label for=edit-question-900Country of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_900 class=form-select country disabled=disabled id=edit-question-900 option value=-- Select country --/optionoption value=1039 selected=selectedCanada/ optionoption value=Kazakhstan/optionoption value=1177Russian Federation/optionoption value=1191Singapore/optionoption value=1193Slovenia/ optionoption value=1196South Africa/optionoption value=1228United States/option/select /div div class=form-item id=edit-question-898-wrapper label for=edit-question-898State or Region of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_898 class=form-select state disabled=disabled id=edit-question-898 option value=-- Select one --/optionoption value=1100 selected=selectedAlberta/ optionoption value=1101British Columbia/optionoption value=1102Manitoba/optionoption value=1103New Brunswick/ optionoption value=1104Newfoundland and Labrador/optionoption value=1105Northwest Territories/optionoption value=1106Nova Scotia/optionoption value=1107Nunavut/optionoption value=1108Ontario/optionoption value=1109Prince Edward Island/optionoption value=1110Quebec/optionoption value=Saskatchewan/optionoption value=1112Yukon Territory/option/select /div On Dec 3, 2:24 pm, jpcozart jeremy.coz...@gmail.com wrote: I would have to see the structure of the document to know where the problem lies. It seems as though country.next(select.state); is not returning the node you are looking for. On Dec 3, 1:07 pm, TMNT tmand...@gmail.com wrote: Matt, thanks for your response. I had originally posted this on jquery-dev group but was referred to this group. How do I access the id of the jquery object returned from the next() function? I tried Matt's suggestion below but I get an 'undefined' when I alert state.attr('id'). thank you. From: Matt Maxwell leftwithoutli...@gmail.com Date: Thu, 3 Dec 2009 05:28:48 -0600 Local: Thurs, Dec 3 2009 3:28 am Subject: Re: [jquery-dev] Re: next() Reply | Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author I would do something like $(select.country).change(function () { var country = $(this), country_id = country.attr(id), state = country.next(select.state); }); state isn't the DOM element, it's the jQuery object, so you'd have to go alert(state.attr(id)); Hope this helps. Also, I agree with Dave, this isn't the place for this kind of question. - Hide quoted text - - Show quoted text - On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin dave.meth...@gmail.com wrote: The jQuery-en group is a better fit for this question. This group is for the discussion of the development of jQuery itself. --
Re: [jQuery] Automagically link http(s)://, mailto: etc in String
Indeed, you could try something like this : string.replace(/((?:(?:http:\/\/)|(?:mailto:))([^\s]+))/, 'a href=$1 title=$2$2/a'); And bam! the returned value will have your http://s and mailto:s wrapped in nice links. Michel Belleville 2009/12/4 Dhruva Sagar dhruva.sa...@gmail.com Of course it's possible :). All you need to do is know a little bit of regular expressions that's pretty much it, you could use simple javascript as well if you like. Thanks Regards, Dhruva Sagar. On Fri, Dec 4, 2009 at 6:09 AM, Scott Wilcox sc...@tig.gr wrote: Hello Folks, I'm usually pretty good at Googling and finding my own answers to problems, however this one has left me a little stumped. Is it possible either using JQuery, a plugin or standard JS to automagically create links for URI's within a string? I'm having a complete block trying to figure this out. Thanks for reading, Scott.
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- www.tnt.be http://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be - www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441
[jQuery] [Draggable] How to cancel drag while dragging
Hi All, I have a scenario where I have a results box and a drop zone where results can be dropped. When the results are dropped, the results box is updated with new results. My problem occurs when dragging a result while the results box is being re-loaded from the previous drop. The results box reloads and removes the object that I am dragging from the DOM. Interestingly, the drop box responds to the cursor and the drop fcn still fires but the element has disappeared from the screen. I tried finding the element being dragged and mvoing it to a container div around the results box right before the ajax call. This works but is really buggy especially in IE. I'm ready to give up and just cancel the drag event right before the ajax call is fired. Is it possible to do this while the user is still dragging? Thanks.
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T T NV) jonat...@tnt.be Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- [image: www.tnt.be] http://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be - www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
That's why I said you needed to find a slow computer to test it on ;-). We need to cater to a diverse audience, and part of that audience is using IE6 on a crappy Intel Celeron chip or Firefox on a G4. Jonathan Michel Belleville wrote: Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T T NV) jonat...@tnt.be mailto:jonat...@tnt.be Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- www.tnt.be http://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be - www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441 -- www.tnt.be http://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be - www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441
[jQuery] Re: Help with Datepicker
You also need to tell it to use a button to trigger the popup using the showOn setting. Set it to 'button' to only popup on the button click and not on focus, or 'both' to show on either. ('#MembershipWizard1_Wizard1_ctl05_ClubConfirmation1_txtStartDate').datepicker ({ dateFormat: 'dd/mm/yy',gotoCurrent: true,minDate: 0, showOn: 'both', buttonImage: 'App_Themes/Images/Ecommerce/datepicker.gif', buttonImageOnly: true });});
[jQuery] Spellchecker plugin
Hi jQuery users I have pretty much finished my simple spellchecker plugin (barring additional functionality) and am wanting some testing/feedback/ criticism/bug reports etc from the jQuery community. My initial inspiration for the plugin came from a work responsibility: to build a spellchecker plugin for a cms we were working on. It was a edit-in-place CMS so the plugin had to work on any block element. We didn't end up using the spellchecker, so i decided to finish it and release as open source. You can view the project page on google code here: http://jquery-spellchecker.googlecode.com/ A full featued demo can be found here: http://spellchecker.jquery.badsyntax.co.uk/ I've also integrated the plugin into the markitup editor here: http://spellchecker.jquery.badsyntax.co.uk/markitup.html So yea that's about it. It's still very beta at this time, but should work on most browsers. Thank your for your time. Rich
[jQuery] jQuery Load, use in Django(help to do load two times)
Hello all, I have a strange problem with jquery load. I have this two loads on a click event: action='first'; $( '#operators_list_div' ).html( 'nbsp;' ).load( '{% url add_save_view %}',{'action':action, }); action='second'; $( '#address_list' ).html( 'nbsp;' ).load( '{% url add_save_view %}', {'action':action,}); On first load, I add something in db(I have more arguments send). At the end I return a template that is a table and here works fine(I see what I added. In second load: Ex I add something with id = 1. I build a list(initial the list is from 1 to 255). After the id=1 was added, the list will be from 2 to 255. If i added an id=3, the list will be 1, 2, 4, 5,...255. Here I want to return another template second.html that update a drop down list with the list build. Here is the problem, sometime the list is correct, other times not. After I add id 1, the list is correctly updated(2,3...255), but sometimes is the default list(1,2...255). The strange things is that is I put an alert, between the two load, it's working fine action='first'; $( '#operators_list_div' ).html( 'nbsp;' ).load( '{% url add_save_view %}',{'action':action, }); alert('brake'); action='second'; $( '#address_list' ).html( 'nbsp;' ).load( '{% url add_save_view %}', {'action':action,}); Somebody know what I do wrong? I put some alerts, before first load, before second load, and in every template. Them are fired like this: First the alert before first load Second the alert before second load(strange, I was expected to fire the alert from the first template) Third the alert form the second template Forth the alert from the first template Why is this order?
Re: [jQuery] Spellchecker plugin
Cool, appreciate the effort, I will check it out soon and give you my feedback. Thanks Regards, Dhruva Sagar. On Fri, Dec 4, 2009 at 3:37 PM, Richard W willis...@gmail.com wrote: Hi jQuery users I have pretty much finished my simple spellchecker plugin (barring additional functionality) and am wanting some testing/feedback/ criticism/bug reports etc from the jQuery community. My initial inspiration for the plugin came from a work responsibility: to build a spellchecker plugin for a cms we were working on. It was a edit-in-place CMS so the plugin had to work on any block element. We didn't end up using the spellchecker, so i decided to finish it and release as open source. You can view the project page on google code here: http://jquery-spellchecker.googlecode.com/ A full featued demo can be found here: http://spellchecker.jquery.badsyntax.co.uk/ I've also integrated the plugin into the markitup editor here: http://spellchecker.jquery.badsyntax.co.uk/markitup.html So yea that's about it. It's still very beta at this time, but should work on most browsers. Thank your for your time. Rich
[jQuery] Is possible to update two div with the same load?
Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks.
Re: [jQuery] Is possible to update two div with the same load?
.load() also has a success triggered callback. Michel Belleville 2009/12/4 NMarcu marcu.nico...@gmail.com Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks.
Re: [jQuery] Is possible to update two div with the same load?
Can you give me please some example or where to find a documentation about what you said. 2009/12/4 Michel Belleville michel.bellevi...@gmail.com .load() also has a success triggered callback. Michel Belleville 2009/12/4 NMarcu marcu.nico...@gmail.com Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks. -- All the best, Nicolae MARCU
Re: [jQuery] Is possible to update two div with the same load?
For some reason I have a feeling you've overlooked the official jQuery documentation on .load(), especially the example section. http://docs.jquery.com/Ajax/load#urldatacallback Michel Belleville 2009/12/4 Nicu Marcu marcu.nico...@gmail.com Can you give me please some example or where to find a documentation about what you said. 2009/12/4 Michel Belleville michel.bellevi...@gmail.com .load() also has a success triggered callback. Michel Belleville 2009/12/4 NMarcu marcu.nico...@gmail.com Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks. -- All the best, Nicolae MARCU
[jQuery] Re: Why mootools animations is more smooth than jquery?
Celeron? BAH! They need to kill that beast. In openSuse, on a not so slow machine ;) running KDE, Firefox 3.5.5 with only the cookie monster plugin activated, I noticed a slight lag in the mootools sample. Some of this perceived speed difference may be a direct result of plugins, or proxy issues in the browsers themselves. The biggest noticeable changes were 2 to 3 and 4 to 1.The direct vertical and horizontal slides were fine in both jQuery and Mootools. On Dec 4, 4:06 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: That's why I said you needed to find a slow computer to test it on ;-). We need to cater to a diverse audience, and part of that audience is using IE6 on a crappy Intel Celeron chip or Firefox on a G4. Jonathan Michel Belleville wrote: Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T T NV) jonat...@tnt.be mailto:jonat...@tnt.be Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441 --www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441
Re: [jQuery] Is possible to update two div with the same load?
I think you're better of with $.get and then doing the finding and loading into both divs yourself. - Richard On Fri, Dec 4, 2009 at 5:21 AM, NMarcu marcu.nico...@gmail.com wrote: Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks.
[jQuery] Re: BlockUI strange behaviour in IE7
Hi, I am not able to post an example at the moment. Does anybody have an idea for solving this problem? Thank you. On Dec 3, 9:54 am, Filipa Andrade filipa.andr...@gmail.com wrote: Hi Mike, sorry but I cant post a link. I will try to make one example of this problem and post it here. As additional information I can say that without BlockUI the problem doesn't happen. I am using it inside an iframe. I am using jquery 1.3.2. Here is the simplified code: div iframe html lang=en xml:lang=en xmlns=http://www.w3.org/1999/xhtml; head titleBlockui example/title meta content=en http-equiv=Content-Language/ meta content=text/html; charset=utf-8 http-equiv=Content-Type/ script src=jquery-1.3.2.min.js type=text/javascript/script script src=jquery.blockUI.js type=text/javascript/script script type=text/javascript src={% staticresource 'js/ jquery.blockUI.js' %}/script script type=text/javascript $(document).ready(function() { $('form.my-form').submit(function() { $.blockUI({ message: 'h1{% trans Updating status... %}/ h1', overlayCSS: { backgroundColor: '#fff', opacity: 0.1 } }); }); }); /script body form method=post action= div table tbody tr td div select id=id_example name=example option selected=selected value=1One/option option value=2Two/option option value=3Three/option /select /div /td /tr /tbody /table /div pinput type=submit value=Save//p /form /body /html /iframe /div On Dec 2, 5:53 pm, Mike Alsup mal...@gmail.com wrote: I am using BlockUI in a pop-up to block it while the new data inserted by the user is updated. It works pretty good in firefox but IE7 has a strange behaviour: after pushing the submit button the overlay message is displayed and the pop- up is closed (until here everything is fine) but after, the page the user was viewing is continued to be refreshed (I dont know exactly what it is doing but the progress bar is continuously moving forward, I dont see any new requests in the server...) Can you post a link?
[jQuery] Re: Why mootools animations is more smooth than jquery?
I have a 'slow computer' that is 6 years old hardware, has been upgraded from windows 3.1 and upward, to the current XP without ever a wipe and reinstall. I figure I'm a worst-case scenario if there ever was one. ;-) I routinely find pages loading extremely slow from javascript-intense sites. But these test cases run equally-smooth with jquery or mootools, for me. I would throw out another possibility here - the particular javascript engine that the browser is using. Might want to check that. (NOTE: I just tried to figure out what version I am using, but danged if I can find anything that tells me what version it is. Give me a pointer what to look for and I'll look again if you want me to). On Dec 4, 5:54 am, wshawn sh...@sanityllc.com wrote: Celeron? BAH! They need to kill that beast. In openSuse, on a not so slow machine ;) running KDE, Firefox 3.5.5 with only the cookie monster plugin activated, I noticed a slight lag in the mootools sample. Some of this perceived speed difference may be a direct result of plugins, or proxy issues in the browsers themselves. The biggest noticeable changes were 2 to 3 and 4 to 1. The direct vertical and horizontal slides were fine in both jQuery and Mootools. On Dec 4, 4:06 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: That's why I said you needed to find a slow computer to test it on ;-). We need to cater to a diverse audience, and part of that audience is using IE6 on a crappy Intel Celeron chip or Firefox on a G4. Jonathan Michel Belleville wrote: Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T T NV) jonat...@tnt.be mailto:jonat...@tnt.be Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441 --www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441- Hide quoted text - - Show quoted text -
[jQuery] jScrollPane - help is needed
Hi All I'm having a problem with jScrollPane. Take a look on http://www.cmt.ca/unstable/ - photo gallery on the right. It loads the whole list first and then limits it to certain width. So my question is - is is possible to eliminate that effect when user sees whole list for a while. Any help will be much appreciated -- View this message in context: http://old.nabble.com/jScrollPane---help-is-needed-tp26635911s27240p26635911.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Save javascript variable via jquery
Hallo all. I would like to save the response of an AJAX call in a variable declared in the document ready in parent page. Imagine this piece of code http://pastie.org/727450 The document ready lives in an iframe so I would like to save in the parent page the var myVariable, not to load it every time with a server-side call. Is there any way to inject in the parent the javascript variable? Kind regards Massimo
Re: [jQuery] Is possible to update two div with the same load?
Well it depends ; most of the times you end up loading a big bit of data that should replace a specific portion of the screen (let the standard .load() behaviour do the heavy lifting for this one) plus a few tidbits like notifications and so on that are secondary (can be dealt with in the callback), so your code is just a little bit more expressive (the main purpose of the query is expressed first in the .load() mandatory parameters, then the secondary tidbits are placed later in the callback). Using .get() would also do the job, but would be slightly less readable later. Michel Belleville 2009/12/4 Richard D. Worth rdwo...@gmail.com I think you're better of with $.get and then doing the finding and loading into both divs yourself. - Richard On Fri, Dec 4, 2009 at 5:21 AM, NMarcu marcu.nico...@gmail.com wrote: Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks.
[jQuery] [validate] Error using rules('remove')
Hi all, I get an error when using rules('remove') from Jörn Zaefferer's Validate plugin. The error is: elem is undefined [Break on this error] var id = elem[ expando ];\r\n The code is: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=http://code.jquery.com/jquery-latest.js;/script script $(document).ready(function(){ $(#myform).validate({ rules: { 'fname': required, 'lname': { required: true } }, messages: { 'fname': Name is required, 'lname': Lastname is required }, errorLabelContainer: #messageBox, wrapper: li, submitHandler: function() { alert(Submitted!) } }) }); /script script function change() { alert('changing rules'); $(#myform).rules('remove'); $(#myform).rules('add', { 'age': { required : true, messages : { required: Age required} } } ); } /script /head body script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script ul id=messageBox/ul form id=myform action=/login method=post labelFirstname/label input name=fname / labelLastname/label input name=lname / labelAge/label input name=age / labelAdress/label input name=address / br/ input type=submit value=Submit/ input type=submit value=Other Submit onclick=change();/ /form /body /html I've missed something or it's a bug in the plugin? Thanks in advance.
[jQuery] Autcomplete extraParams usage
I want to pass some value (other than that i type in text box) when i am using autcomplete . for that i am using extraParams and passing it in the below manner extraParams: { id: 1234, }, so how can i get the value in php which i passed as extraParams.
[jQuery] validate
Hello all, I am using the JQuery validator from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ . And I am using the calandar component from YUI. The problem is similar to what bobbykjack has . I have an input field ,when user clicks into it the calendar pops up. When user chooses a date it fills the input box. But the error message which had been displayed on clicking the submit button before the field was filled does not go away. How do I get rid off it?. Thanks in advance . Sucheta
[jQuery] Can't get the js of superfish to work
I get these faults: jQuery is not defined hoverIntent.js()hoverIntent.js (rad 84) [Break on this error] })(jQuery);hoverIntent.js (rad 84) jQuery is not defined superfish.js()superfish.js (rad 121) [Break on this error] })(jQuery);\nsuperfish.js (rad 121) $(ul.sf-menu).superfish is not a function anonymous()halvskarp.html (rad 16) anonymous()jquery-1...6.minb.js (rad 27) anonymous()jquery-1...6.minb.js (rad 27) anonymous([function()], function(), Object name=args) jquery-1...6.minb.js (rad 21) anonymous()jquery-1...6.minb.js (rad 27) [Break on this error] $('ul.sf-menu').superfish(); \n
[jQuery] Can I use $(document).ready(function(){ in the same page more than a once time in the same page
Hello i'm new here, Is it posible?
Re: [jQuery] Can I use $(document).ready(function(){ in the same page more than a once time in the same page
Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
[jQuery] Re: Can I use $(document).ready(function(){ in the same page more than a once time in the same page
ok, thanks for the response. But what is the best, is it good to have more than a documen.ready ? it doesn't bring problems? On 4 dic, 11:33, Andreas Möller localhe...@l8m.de wrote: Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
Re: [jQuery] Autcomplete extraParams usage
You can get it in PHP as $_REQUEST['id'] Thanks Regards, Dhruva Sagar. On Fri, Dec 4, 2009 at 8:06 PM, .. cognizantst...@gmail.com wrote: I want to pass some value (other than that i type in text box) when i am using autcomplete . for that i am using extraParams and passing it in the below manner extraParams: { id: 1234, }, so how can i get the value in php which i passed as extraParams.
[jQuery] Re: jScrollPane - help is needed
On Dec 4, 10:07 am, xirurg vshala...@hotmail.com wrote: I'm having a problem with jScrollPane. Take a look onhttp://www.cmt.ca/unstable/- photo gallery on the right. It loads the whole list first and then limits it to certain width. So my question is - is is possible to eliminate that effect when user sees whole list for a while. Well, since this section doesn't work well without Javascript, you could limit the size in CSS, then override that with JS. Perhaps: ul.unstable_photoWidth { width: 335px; height: 65px; overflow: hidden; } then somewhere after load but before your scroll pane code, add $(ul.unstable_photoWidth).css({width: 85 * $(li, this).size(), overflow: auto}); That might do it... Good luck, -- Scott
[jQuery] Re: Can I use $(document).ready(function(){ in the same page more than a once time in the same page
there's no problems with it... as for best, that completely applies to the situation, there is no one, all-encompassing answer for that On Dec 4, 10:35 am, coolf jm.neut...@gmail.com wrote: ok, thanks for the response. But what is the best, is it good to have more than a documen.ready ? it doesn't bring problems? On 4 dic, 11:33, Andreas Möller localhe...@l8m.de wrote: Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
Re: [jQuery] Re: Can I use $(document).ready(function(){ in the same page more than a once time in the same page
Basically, my advice would be : 1. first, load jQuery 2. then load jQuery extensions (UI, plugins) 3. then load your own domain-specific extensions (method declarations, etc.) 4. then load your page hooks (in a $(function() { ... }) block so it starts when the page is complete), preferably grouped by functionalities And it's usually better to write less code in 4. than in 3. (4. is preferably just for hooks). Michel Belleville 2009/12/4 coolf jm.neut...@gmail.com ok, thanks for the response. But what is the best, is it good to have more than a documen.ready ? it doesn't bring problems? On 4 dic, 11:33, Andreas Möller localhe...@l8m.de wrote: Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
[jQuery] Re: Selector issue
I wouldn't suggest going the .live route if you plan on having a lot of children of cat_list using event delegation, there is one single event wired up that handles 1 child or 1200 children using .live, you would have N number of events sitting there wired up where N is the number of children. but whatever works i suppose On Dec 4, 3:35 am, Civette la.cive...@gmail.com wrote: Well, after a few tests, this works fine : $(#cat_list div).live(click, function() { alert($(this).attr(id)); }); thanx
[jQuery] Re: Jcarrousel smooth autoscrolling
up On 2 déc, 12:21, teemak yacine.mourc...@gmail.com wrote: Hi there, I use Jcaroussel with circular autoscrolling setting. It's works but at each picture it stops (just a second but it stop) and restart. I have to do a smooth (or soft) autscrolling. Thanks. Teemak PS: Sorry for mistakes but i'm french ^^
[jQuery] Re: Can I use $(document).ready(function(){ in the same page more than a once time in the same page
thanks to all On 4 dic, 12:08, Michel Belleville michel.bellevi...@gmail.com wrote: Basically, my advice would be : 1. first, load jQuery 2. then load jQuery extensions (UI, plugins) 3. then load your own domain-specific extensions (method declarations, etc.) 4. then load your page hooks (in a $(function() { ... }) block so it starts when the page is complete), preferably grouped by functionalities And it's usually better to write less code in 4. than in 3. (4. is preferably just for hooks). Michel Belleville 2009/12/4 coolf jm.neut...@gmail.com ok, thanks for the response. But what is the best, is it good to have more than a documen.ready ? it doesn't bring problems? On 4 dic, 11:33, Andreas Möller localhe...@l8m.de wrote: Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
[jQuery] Re: Save javascript variable via jquery
I tried this way: http://pastie.org/727632 The div is appendend but the javascript declaration not: Any idea? Kind regards Massimo On 4 Dic, 16:13, m.ugues m.ug...@gmail.com wrote: Hallo all. I would like to save the response of an AJAX call in a variable declared in the document ready in parent page. Imagine this piece of code http://pastie.org/727450 The document ready lives in an iframe so I would like to save in the parent page the var myVariable, not to load it every time with a server-side call. Is there any way to inject in the parent the javascript variable? Kind regards Massimo
Re: [jQuery] Re: Why mootools animations is more smooth than jquery?
Just out of curiosity, which browser are you using? Did you try it in more than one? --Karl On Dec 4, 2009, at 9:43 AM, donb wrote: I have a 'slow computer' that is 6 years old hardware, has been upgraded from windows 3.1 and upward, to the current XP without ever a wipe and reinstall. I figure I'm a worst-case scenario if there ever was one. ;-) I routinely find pages loading extremely slow from javascript-intense sites. But these test cases run equally-smooth with jquery or mootools, for me. I would throw out another possibility here - the particular javascript engine that the browser is using. Might want to check that. (NOTE: I just tried to figure out what version I am using, but danged if I can find anything that tells me what version it is. Give me a pointer what to look for and I'll look again if you want me to). On Dec 4, 5:54 am, wshawn sh...@sanityllc.com wrote: Celeron? BAH! They need to kill that beast. In openSuse, on a not so slow machine ;) running KDE, Firefox 3.5.5 with only the cookie monster plugin activated, I noticed a slight lag in the mootools sample. Some of this perceived speed difference may be a direct result of plugins, or proxy issues in the browsers themselves. The biggest noticeable changes were 2 to 3 and 4 to 1.The direct vertical and horizontal slides were fine in both jQuery and Mootools. On Dec 4, 4:06 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: That's why I said you needed to find a slow computer to test it on ;-). We need to cater to a diverse audience, and part of that audience is using IE6 on a crappy Intel Celeron chip or Firefox on a G4. Jonathan Michel Belleville wrote: Just used your benchmark and I didn't see any significant differences. Both had slight jumps from time to time, none felt like there was a pattern, I'm using Firefox 3.5 on a iMac pro (last year's edition) running snow leopard. Michel Belleville 2009/12/4 Jonathan Vanherpe (T T NV) jonat...@tnt.be mailto:jonat...@tnt.be Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there: http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan -- www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441 --www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441- Hide quoted text - - Show quoted text -
[jQuery] Basic Bind Question
Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: Need help in jquery script for copying values
Sorry to ask a silly question like this. I solved this . Here goes the modified script : $('#addEmployee').click(function(){ $.ajax({ url: 'searchEmployee.do?method=searchEmployee', type: 'GET', data: {employeeId: $('input#emp').val()}, success: function(data) { if($('textarea#employee_id_textarea').val() ==){ $('textarea#employee_id_textarea').val(data) ; } else { $('textarea#employee_id_textarea').val($ ('textarea#employee_id_textarea').val() +, +data); } $('div#resultEmp').html().css(padding,0); $('input#emp').val(); } }); Thanks, Rose On Dec 3, 1:14 pm, rose roselin.mar...@gmail.com wrote: Hi All, I have a below jquery function to search the employee data and show the result. i have a text box in which the user type in the empid and click on search. Once user clicks on search it shows the employee detail such as name, sex, race etc below the textbox. $('#addEmployee').click(function(){ $.ajax({ url: 'searchEmployee.do?method=searchEmployee', type: 'GET', data: {employeeId: $('input#emp').val()}, success: function(data) { $('div#resultEmp').css(padding,10px 0 10px 0).html(data); } }); }); Once i get the proper employee data such as empid, name, race etc. I have a href link for the empid . I click on the emp id link and i copy that employee id into the textarea i have right below the results. Now the user doesn't want to click on the emp id to copy the value on the textarea. They just want if data from backend is correct directly copy to the textarea without clicking on empid(which i am showing as results after clicking search). To copy emp id from the link to textarea i am calling another javascript as below : // Function for copying Employee Id to the textarea. function selectEmp(id) { if($('textarea#employee_id_textarea').val() ==){ $('textarea#employee_id_textarea').val(id) ; } else { $('textarea#employee_id_textarea').val($ ('textarea#employee_id_textarea').val() +, +id); } $('div#resultEmp').html().css(padding,0); $('input#emp').val(); } Could you please advise how i can do that? After result success i want to copy the empid directly to the textarea without clicking. I don't even know if i have made myself clear. Please let me know if you need more information. Thanks in advance.
Re: [jQuery] Basic Bind Question
Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
Re: [jQuery] Basic Bind Question
Hi Karl: Awesome! Got it :) Thanks for the explanation and examples. Charlie On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com wrote: Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
Re: [jQuery] Re: Selector issue
On Dec 4, 2009, at 11:09 AM, MorningZ wrote: I wouldn't suggest going the .live route if you plan on having a lot of children of cat_list using event delegation, there is one single event wired up that handles 1 child or 1200 children using .live, you would have N number of events sitting there wired up where N is the number of children. but whatever works i suppose Nah. Using .live() wires up one event handler to document. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Selector issue
Well I dont think I'll have more than about 15 childs here. Thx for help On 4 déc, 17:09, MorningZ morni...@gmail.com wrote: I wouldn't suggest going the .live route if you plan on having a lot of children of cat_list using event delegation, there is one single event wired up that handles 1 child or 1200 children using .live, you would have N number of events sitting there wired up where N is the number of children. but whatever works i suppose On Dec 4, 3:35 am, Civette la.cive...@gmail.com wrote: Well, after a few tests, this works fine : $(#cat_list div).live(click, function() { alert($(this).attr(id)); }); thanx
Re: [jQuery] Re: Save javascript variable via jquery
Your first example doesn't work because getJSON doesn't return the JSON data as its return value; it *calls a function* and passes the data as an argument to that function. Remember that getJSON is asynchronous. The call to getJSON returns before the data is even downloaded. Any time you have asynchronous operations in JavaScript, you'll do them through a callback function like this. (There is a synchronous option for getJSON, but you really don't want to use it - it causes serious problems.) Your getJSON callback function *could* store the data in a variable in the parent page: $.getJSON( url, function( data ) { top.myData = data; }); But there's a flaw in this approach. How does the code in the parent page know when the data is ready? It doesn't. Instead, you should provide a function in the parent page and *call* it from the getJSON callback: $.getJSON( url, function( data ) { top.dataIsReady( data ); }); where the parent page has this global function: function dataIsReady( data ) { // ... } In fact, if calling that function is the only thing your callback does, you could just use the function directly as the callback: $.getJSON( url, top.dataIsReady ); -Mike On Fri, Dec 4, 2009 at 8:29 AM, m.ugues m.ug...@gmail.com wrote: I tried this way: http://pastie.org/727632 The div is appendend but the javascript declaration not: Any idea? Kind regards Massimo On 4 Dic, 16:13, m.ugues m.ug...@gmail.com wrote: Hallo all. I would like to save the response of an AJAX call in a variable declared in the document ready in parent page. Imagine this piece of code http://pastie.org/727450 The document ready lives in an iframe so I would like to save in the parent page the var myVariable, not to load it every time with a server-side call. Is there any way to inject in the parent the javascript variable? Kind regards Massimo
Re: [jQuery] Re: Can I use $(document).ready(function(){ in the same page more than a once time in the same page
It really makes little difference at all. jQuery makes an array of all your ready callbacks, and when the document is ready it loops through that array and calls each function. So other than that tiny bit of overhead, the net effect is exactly the same whether you put all the code in one ready function or have several different ones. If there is more than one, they will be called in the same order that the $(document).ready() calls were executed. -Mike On Fri, Dec 4, 2009 at 7:35 AM, coolf jm.neut...@gmail.com wrote: ok, thanks for the response. But what is the best, is it good to have more than a documen.ready ? it doesn't bring problems? On 4 dic, 11:33, Andreas Möller localhe...@l8m.de wrote: Hello i'm new here, Is it posible? Yes, it is. Best regards, Andreas
Re: [jQuery] Basic Bind Question
Yep Karl's explanation was great. Also, you can leverage bind() to work with your own custom events in the case where you want to define something that needs to be triggered based on another action. Using the code from the docs, you can see what I'm talking about: $(p).bind(myCustomEvent, function(e, myName, myValue){ $(this).text(myName + , hi there!); $(span).stop().css(opacity, 1) .text(myName = + myName) .fadeIn(30).fadeOut(1000); }); $(button).click(function () { $(p).trigger(myCustomEvent, [ John ]); }); Rey... Charlie Griefer wrote: Hi Karl: Awesome! Got it :) Thanks for the explanation and examples. Charlie On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com mailto:k...@englishrules.com wrote: Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;/script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
Re: [jQuery] Basic Bind Question
Oh yeah, that too! :-D --Karl On Dec 4, 2009, at 1:41 PM, Rey Bango wrote: Yep Karl's explanation was great. Also, you can leverage bind() to work with your own custom events in the case where you want to define something that needs to be triggered based on another action. Using the code from the docs, you can see what I'm talking about: $(p).bind(myCustomEvent, function(e, myName, myValue){ $(this).text(myName + , hi there!); $(span).stop().css(opacity, 1) .text(myName = + myName) .fadeIn(30).fadeOut(1000); }); $(button).click(function () { $(p).trigger(myCustomEvent, [ John ]); }); Rey... Charlie Griefer wrote: Hi Karl: Awesome! Got it :) Thanks for the explanation and examples. Charlie On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com mailto:k...@englishrules.com wrote: Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.com http://www.englishrules.com www.learningjquery.com http://www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.js/script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Suckerfish dropdowns not working in IE -- JQuery is undefined
My suckerfish dropdown menu isn't working in IE. http://www.alliedcash.com/comparison/ (I've attached a dropdown menu to the Resources button / link) It works fine in Firefox, .. but in IE it gives me the following error messages. Please advise. Message: 'jQuery' is undefined Line: 1 Char: 1 Code: 0 URI: http://www.alliedcash.com/js/hoverIntent.js Message: 'jQuery' is undefined Line: 13 Char: 2 Code: 0 URI: http://www.alliedcash.com/js/superfish.js Message: Object expected Line: 42 Char: 3 Code: 0 URI: http://www.alliedcash.com/comparison/ - Yvan
[jQuery] Re: Basic Bind Question
Got two more uses for ya. Namespacing of events: // set two click events with different namespaces $('.button').bind('click.namespace1', function () { }).bind('click.namespace2', function () { }); //remove just one of them $('.button').unbind('click.namespace1', function () { }); and passing of data: $('.button').bind('click', {'name': 'value'}, function (e) { console.log(e.data.name); // logs value }); On Dec 4, 10:41 am, Rey Bango r...@reybango.com wrote: Yep Karl's explanation was great. Also, you can leverage bind() to work with your own custom events in the case where you want to define something that needs to be triggered based on another action. Using the code from the docs, you can see what I'm talking about: $(p).bind(myCustomEvent, function(e, myName, myValue){ $(this).text(myName + , hi there!); $(span).stop().css(opacity, 1) .text(myName = + myName) .fadeIn(30).fadeOut(1000); }); $(button).click(function () { $(p).trigger(myCustomEvent, [ John ]); }); Rey... Charlie Griefer wrote: Hi Karl: Awesome! Got it :) Thanks for the explanation and examples. Charlie On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com mailto:k...@englishrules.com wrote: Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;/script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] plugin namespace
The website I'm working with has jQuery and the jQuery Form plugin (jquery.form.js) included on every page (it can be used with the syntax $j). However, they are using a newer version of jQuery with an older version of the Form plugin... and this causes some errors. So, I would like to include my own version of the Form plugin. It has been recommended that I put the plugin into a different namespace, but I am not familiar with namespaces in JavaScript. After researching a little on the internet, it seems like everyone has a different way of implementing namespaces, and I don't know what works with jQuery. So, how can I create the plugin in a separate namespace and use it in my code? -Ben
[jQuery] FadeIn / FadeOut IE8
I have a site, http://www.faith-photography.com, using the fadeIn/Out with standard jpgs.The process works flawlessly in every browser except IE8 when set to IE8 view. If set to IE7 it works, but not as smoothly as you can see in Firefox or any web-kit type browser. Anyone know of a workaround for the IE8 issue? I have this on every site using fades.
[jQuery] Re: Why mootools animations is more smooth than jquery?
How the plugin is written is a huge part. I have jealously noticed in the past that mootools animations typically seem to be smoother, especially on slower machines and cruddy browsers, but I stick with jQuery because I really like the syntax community. However, I agree that no one has really provide any proof that mootools is smoother. Sorry Jonathan, in the demo you show above, we don't have a good comparison because I can see already that there are scrollbars in FF for jQuery demo and no scrollbars in the mootools, and I'm sure scrollbars will have an effect. Also Karl makes a good point about easing...there is some psychology going on here. But to give credit to the demo somewhat, here is what I saw. The mootools looks a lot better on my FF on macbook pro snow. The jQuery is choppy for diagonals and seems to be moving like its on a staircase. But in safari, things look pretty smooth for both. Browser's always come into play. Fellow developers and I concur that FF is becoming rather laggy these days and is falling far behind webkit stuff in performance, even with extensions disabled...sorry to say because developers need and bleed with firefox and firebug. If I had time, I would do what Rey suggests and break down that stuff to really file a proper complaint with the FF team. I know I can't really demand and expect a solution for a open source project unless I contribute in some real practical way (not just mouthing off). On Dec 4, 2:54 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: Karl Swedberg wrote: On Dec 3, 2009, at 7:31 PM, Dave Methvin wrote: I refrained from replying because the OP seemed trollish, but he has a point, IMHO. It would be great if someone who knew both frameworks could set up a page that demonstrated a side-by-side case where Mootools has smoother animations than jQuery. Otherwise it's hard do know what might be causing the problem, or even whether there's a problem at all. That's a great idea, Dave. I wonder how much the easing equation affects people's perception of smoothness. It might be worthwhile to try animations using the easing plugin and see if any of those equations feel smoother. --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com ok, I've used some code I had lying around and put dummy content in there:http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Again, this might be the fault of the plugin I'm using, if you have another way of doing the same thing in jQuery you can tell me so I know for next time. I really prefer using jQuery, but sometimes I just can't because of things like this. Jonathan --www.tnt.behttp://www.tnt.be/?source=emailsig *Jonathan Vanherpe* jonat...@tnt.be mailto:jonat...@tnt.be -www.tnt.be http://www.tnt.be/?source=emailsig - tel.: +32 (0)9 3860441
[jQuery] Re: Suckerfish dropdowns not working in IE -- JQuery is undefined
Nevermind .. I got it working. On Dec 4, 2:20 pm, Yvan yvana...@gmail.com wrote: My suckerfish dropdown menu isn't working in IE. http://www.alliedcash.com/comparison/ (I've attached a dropdown menu to the Resources button / link) It works fine in Firefox, .. but in IE it gives me the following error messages. Please advise. Message: 'jQuery' is undefined Line: 1 Char: 1 Code: 0 URI:http://www.alliedcash.com/js/hoverIntent.js Message: 'jQuery' is undefined Line: 13 Char: 2 Code: 0 URI:http://www.alliedcash.com/js/superfish.js Message: Object expected Line: 42 Char: 3 Code: 0 URI:http://www.alliedcash.com/comparison/ - Yvan
Re: [jQuery] plugin namespace
including it on every page seems troublesome and hard to maintain. if you using PHP or ASP you can create your own Master Page and include there once. and load your other pages in as they are needed. my suggestion to you in converting to a CMS then you can include your script in only one file and all other pages will read it. check this. the standard way of using jQuery 1. $(function() { var h = $(body'); h.hide(); }); 2. may be try this way var $namespace = jQuery.noConflict(); $namespace(function() { var h = $namespace(body): h.hide(); }); On Fri, Dec 4, 2009 at 7:10 PM, ben2233 ben.duf...@cerner.com wrote: The website I'm working with has jQuery and the jQuery Form plugin (jquery.form.js) included on every page (it can be used with the syntax $j). However, they are using a newer version of jQuery with an older version of the Form plugin... and this causes some errors. So, I would like to include my own version of the Form plugin. It has been recommended that I put the plugin into a different namespace, but I am not familiar with namespaces in JavaScript. After researching a little on the internet, it seems like everyone has a different way of implementing namespaces, and I don't know what works with jQuery. So, how can I create the plugin in a separate namespace and use it in my code? -Ben
[jQuery] Re: next()
Michel, thanks for your response. So, do I need to get the parent of my country element (which would be the div ) get all it's siblings and then look for elements with class 'state' or is there a simpler way? On Dec 4, 12:47 am, Michel Belleville michel.bellevi...@gmail.com wrote: That's easy, .next() finds the nearer next *sibling* of current element matching the selector. In your case, your element is not current element's sibling, it's under another node altogether. div span class=mehey, it's me !!/span spanand I'm his sibling/span aand I am too/a p spanthough I am not because I'm not the direct child of the same direct parent/span /p /div div aneither am I, I'm also in another parent, the fact that I'm on the same indentation level is not enough to make me directly related to this span.me guy/a /div Hope it helps. Michel Belleville 2009/12/4 TMNT tmand...@gmail.com Thank you jpcozart. here's part of my html: div class=form-item id=edit-question-900-wrapper label for=edit-question-900Country of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_900 class=form-select country disabled=disabled id=edit-question-900 option value=-- Select country --/optionoption value=1039 selected=selectedCanada/ optionoption value=Kazakhstan/optionoption value=1177Russian Federation/optionoption value=1191Singapore/optionoption value=1193Slovenia/ optionoption value=1196South Africa/optionoption value=1228United States/option/select /div div class=form-item id=edit-question-898-wrapper label for=edit-question-898State or Region of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_898 class=form-select state disabled=disabled id=edit-question-898 option value=-- Select one --/optionoption value=1100 selected=selectedAlberta/ optionoption value=1101British Columbia/optionoption value=1102Manitoba/optionoption value=1103New Brunswick/ optionoption value=1104Newfoundland and Labrador/optionoption value=1105Northwest Territories/optionoption value=1106Nova Scotia/optionoption value=1107Nunavut/optionoption value=1108Ontario/optionoption value=1109Prince Edward Island/optionoption value=1110Quebec/optionoption value=Saskatchewan/optionoption value=1112Yukon Territory/option/select /div On Dec 3, 2:24 pm, jpcozart jeremy.coz...@gmail.com wrote: I would have to see the structure of the document to know where the problem lies. It seems as though country.next(select.state); is not returning the node you are looking for. On Dec 3, 1:07 pm, TMNT tmand...@gmail.com wrote: Matt, thanks for your response. I had originally posted this on jquery-dev group but was referred to this group. How do I access the id of the jquery object returned from the next() function? I tried Matt's suggestion below but I get an 'undefined' when I alert state.attr('id'). thank you. From: Matt Maxwell leftwithoutli...@gmail.com Date: Thu, 3 Dec 2009 05:28:48 -0600 Local: Thurs, Dec 3 2009 3:28 am Subject: Re: [jquery-dev] Re: next() Reply | Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author I would do something like $(select.country).change(function () { var country = $(this), country_id = country.attr(id), state = country.next(select.state); }); state isn't the DOM element, it's the jQuery object, so you'd have to go alert(state.attr(id)); Hope this helps. Also, I agree with Dave, this isn't the place for this kind of question. - Hide quoted text - - Show quoted text - On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin dave.meth...@gmail.com wrote: The jQuery-en group is a better fit for this question. This group is for the discussion of the development of jQuery itself. --
[jQuery] Need help finalizing superfish dropdown menu
I'm having some difficulty finalizing my suckerfish dropdown menu on this page (ie: Resources button / link): http://www.alliedcash.com/comparison/ Here are the 3 problems that I'm trying to correct: 1) I want to eliminate the right border for each of my sublinks -- I can't seem to access / override that css property 2) When I mouseover the sublinks -- I'd like for the Resources link text to remain white (instead of turning blue) 3) In IE -- when I mouseover the sublinks -- the widths of each of teh sublinks varies on hover -- I want them to all be the same width (like the way it displays in Firefox) 4) In IE -- the left edge of the subnav list doens't line up wih the left edge of the Resources button (like the way it displays in Firefox) Any help would be appreciated. Thanks! - Yvan
[jQuery] Re: plugin namespace
I think I over-simplified the situation. I'm writing a widget (which dynamically generates contents of a div element on the page, in this case) that gets plugged into various parts of the website. And the entire website is reliant on jQuery, so the jQuery code and plugins are already included in every location where the widget gets run. It doesn't use PHP or ASP. But I'll take a look at using your second suggestion, with noConflict(). I was able to add the Form plugin into my code, and it overrode the old plugin. But if another widget is reliant on the original Form plugin, then it would break their code. Hence the namespaces. Any other ideas are still welcome. -Ben On Dec 4, 2:19 pm, waseem sabjee waseemsab...@gmail.com wrote: including it on every page seems troublesome and hard to maintain. if you using PHP or ASP you can create your own Master Page and include there once. and load your other pages in as they are needed. my suggestion to you in converting to a CMS then you can include your script in only one file and all other pages will read it. check this. the standard way of using jQuery 1. $(function() { var h = $(body'); h.hide(); }); 2. may be try this way var $namespace = jQuery.noConflict(); $namespace(function() { var h = $namespace(body): h.hide(); }); On Fri, Dec 4, 2009 at 7:10 PM, ben2233 ben.duf...@cerner.com wrote: The website I'm working with has jQuery and the jQuery Form plugin (jquery.form.js) included on every page (it can be used with the syntax $j). However, they are using a newer version of jQuery with an older version of the Form plugin... and this causes some errors. So, I would like to include my own version of the Form plugin. It has been recommended that I put the plugin into a different namespace, but I am not familiar with namespaces in JavaScript. After researching a little on the internet, it seems like everyone has a different way of implementing namespaces, and I don't know what works with jQuery. So, how can I create the plugin in a separate namespace and use it in my code? -Ben- Hide quoted text - - Show quoted text -
[jQuery] Re: Selector issue
Nah. Using .live() wires up one event handler to document. --Karl Doh, shame on me for my lack of facts on that .live()... i'll read up on it some, as i usually, well always, take the delegation route..
Re: [jQuery] Multipart forms, file uploads and the accept header
Similar issue: ajax working fine until I tried to upload. I found out that (a) most browser clients don't know what to do with header application/json (b) the solution text/javascript is mixed up for some reason extra tags get added on which confuses the parsing (c) try setting your header as text/html that's what worked for me Sorry, I can't give you concrete details about what's going on. Still an ajax-n00b. Chris Roos-3 wrote: Morning, I have a simple file upload form. It works exactly as expected without javascript. It *almost* works as expected when I convert it to an ajax form, with something like form.ajaxSubmit(options). My options contain a dataType definition, {'dataType' : 'json'}. I believe that this directly relates to the HTTP Accept header and lets my server know the type of data that I'm expecting to get back. If I don't select a file to upload and hit submit then the Accept header is populated correctly (application/json, text/javascript, */*). If I do select a file to upload and hit submit then the Accept header ignores my dataType and appears to default to the browser default (something like text/html,application/xhtml+xml,application/ xml;q=0.9,*/*;q=0.8). In practice, this means that although the file is uploaded correctly, I'm unable to determine the the type of response required from the server (in Rails I can't use respond_to to detect a request for a js response). I'm wondering whether this is by design or whether something's wrong here. Does anyone have any thoughts? Cheers, Chris -- View this message in context: http://old.nabble.com/Multipart-forms%2C-file-uploads-and-the-accept-header-tp22371165s27240p26638195.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Re: Basic Bind Question
Thanks all. I appreciate all the responses and examples. Really helps out a lot. Charlie On Fri, Dec 4, 2009 at 11:34 AM, seasoup seas...@gmail.com wrote: Got two more uses for ya. Namespacing of events: // set two click events with different namespaces $('.button').bind('click.namespace1', function () { }).bind('click.namespace2', function () { }); //remove just one of them $('.button').unbind('click.namespace1', function () { }); and passing of data: $('.button').bind('click', {'name': 'value'}, function (e) { console.log(e.data.name); // logs value }); On Dec 4, 10:41 am, Rey Bango r...@reybango.com wrote: Yep Karl's explanation was great. Also, you can leverage bind() to work with your own custom events in the case where you want to define something that needs to be triggered based on another action. Using the code from the docs, you can see what I'm talking about: $(p).bind(myCustomEvent, function(e, myName, myValue){ $(this).text(myName + , hi there!); $(span).stop().css(opacity, 1) .text(myName = + myName) .fadeIn(30).fadeOut(1000); }); $(button).click(function () { $(p).trigger(myCustomEvent, [ John ]); }); Rey... Charlie Griefer wrote: Hi Karl: Awesome! Got it :) Thanks for the explanation and examples. Charlie On Fri, Dec 4, 2009 at 9:01 AM, Karl Swedberg k...@englishrules.com mailto:k...@englishrules.com wrote: Hey Charlie, methods such as .click() and .mouseover() are just convenience methods. They all use .bind() internally. One nice thing about .bind() is that you can use multiple event types with it. For example, instead of doing this: $('a') .mouseover(function() { var $link = $(this); // do something with $link }) .mouseout(function() { var $link = $(this); // do something with $link }); You can combine them and avoid some repetition: $('a') .bind('mouseover mouseout', function(event) { var $link = $(this); if (event.type == 'mouseover') { // do something with $link on mouseover } else { // do something with $link on mouseout } }); --Karl Karl Swedberg www.englishrules.comhttp://www.englishrules.com www.learningjquery.comhttp://www.learningjquery.com On Dec 4, 2009, at 11:46 AM, Charlie Griefer wrote: Hi All: I've read over the docs, but don't quite understand what the bind() event provides versus just assigning a particular event handler to a selected element (or set of elements). For example, consider the code below. What's the difference between the interaction with the p elements of class first, and the p elements of class second? Isn't the second bit effectively binding a click event handler to a specific batch of p elements just as the first one is? Just not grokking it. Would appreciate if anybody could enlighten me. script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script script type=text/javascript $(document).ready(function() { $('p.first').bind('click', function() { alert($(this).text()); }); $('p.second').click(function() { alert($(this).text()); }); }); /script p class=firstA/p p class=firstB/p p class=firstC/p p class=firstD/p p class=firstE/p hr / p class=secondF/p p class=secondG/p p class=secondH/p p class=secondI/p p class=secondJ/p -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: binding ala ActionScript??
Thanks Karl! I'll give it a try. Harvey
Re: [jQuery] Re: Selector issue
The .live() method uses event delegation under the hood. doing this: $('a').live('click', function() { // do something }); is like doing this: $(document).bind('click', function(event) { if ($(event.target).closest('a').length) { // do something } }); except that with .live() the selector engine does have to initially traverse the DOM to find all of the a elements just by virtue of 'a' being in the jQuery function. not sure, but that might be changing in 1.4. Also, I haven't had a chance to look yet, but 1.4 also might let you pass in a context for .live() so you don't have to bind to document each time. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Dec 4, 2009, at 3:39 PM, MorningZ wrote: Nah. Using .live() wires up one event handler to document. --Karl Doh, shame on me for my lack of facts on that .live()... i'll read up on it some, as i usually, well always, take the delegation route..
[jQuery] New question
Hi. Not sure if this is a good place for my question, but I'll give it a shot.. I'm looking for a couple of sies that I can rip apart to see how they work. I'm looking for test sites that allow a user to match items from different columns together. Basicaly, if I give the user a list of items, then the user would want to select items from the next list, and match the items in colA, with items in colB. The lists/cols, would be generated from an underlying database, the UI portion of the site, would be in ajax. I'm just trying to get my head around how this could be accomplished.. My test is going to simulate students who would be taking classes, and matching the books required for their classes... thoughts/comments are appreciated.. thanks -bruce
[jQuery] javascript variable scope
This surprised me. I made the scenario as simple as possible. http://jsbin.com/eyopo3/edit You can see in function g() I change the value of the variable i after having used it. That may seem like a useless thing to do, but in the production code I was working on, i was a loop iterator. -- View this message in context: http://old.nabble.com/javascript-variable-scope-tp26648745s27240p26648745.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] Re: next()
Well it would work if a bit complicated and probably a pain to maintain. If there wouldn't be any other select named like your second select, I'd rather select it by its name if I were you. Or perhaps give these specific select a common ancestor and select it using this common ancestor as reference. Michel Belleville 2009/12/4 TMNT tmand...@gmail.com Michel, thanks for your response. So, do I need to get the parent of my country element (which would be the div ) get all it's siblings and then look for elements with class 'state' or is there a simpler way? On Dec 4, 12:47 am, Michel Belleville michel.bellevi...@gmail.com wrote: That's easy, .next() finds the nearer next *sibling* of current element matching the selector. In your case, your element is not current element's sibling, it's under another node altogether. div span class=mehey, it's me !!/span spanand I'm his sibling/span aand I am too/a p spanthough I am not because I'm not the direct child of the same direct parent/span /p /div div aneither am I, I'm also in another parent, the fact that I'm on the same indentation level is not enough to make me directly related to this span.me guy/a /div Hope it helps. Michel Belleville 2009/12/4 TMNT tmand...@gmail.com Thank you jpcozart. here's part of my html: div class=form-item id=edit-question-900-wrapper label for=edit-question-900Country of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_900 class=form-select country disabled=disabled id=edit-question-900 option value=-- Select country --/optionoption value=1039 selected=selectedCanada/ optionoption value=Kazakhstan/optionoption value=1177Russian Federation/optionoption value=1191Singapore/optionoption value=1193Slovenia/ optionoption value=1196South Africa/optionoption value=1228United States/option/select /div div class=form-item id=edit-question-898-wrapper label for=edit-question-898State or Region of ED Submitter span class=form-required title=This field is required.*/span: / label select name=question_898 class=form-select state disabled=disabled id=edit-question-898 option value=-- Select one --/optionoption value=1100 selected=selectedAlberta/ optionoption value=1101British Columbia/optionoption value=1102Manitoba/optionoption value=1103New Brunswick/ optionoption value=1104Newfoundland and Labrador/optionoption value=1105Northwest Territories/optionoption value=1106Nova Scotia/optionoption value=1107Nunavut/optionoption value=1108Ontario/optionoption value=1109Prince Edward Island/optionoption value=1110Quebec/optionoption value=Saskatchewan/optionoption value=1112Yukon Territory/option/select /div On Dec 3, 2:24 pm, jpcozart jeremy.coz...@gmail.com wrote: I would have to see the structure of the document to know where the problem lies. It seems as though country.next(select.state); is not returning the node you are looking for. On Dec 3, 1:07 pm, TMNT tmand...@gmail.com wrote: Matt, thanks for your response. I had originally posted this on jquery-dev group but was referred to this group. How do I access the id of the jquery object returned from the next() function? I tried Matt's suggestion below but I get an 'undefined' when I alert state.attr('id'). thank you. From: Matt Maxwell leftwithoutli...@gmail.com Date: Thu, 3 Dec 2009 05:28:48 -0600 Local: Thurs, Dec 3 2009 3:28 am Subject: Re: [jquery-dev] Re: next() Reply | Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author I would do something like $(select.country).change(function () { var country = $(this), country_id = country.attr(id), state = country.next(select.state); }); state isn't the DOM element, it's the jQuery object, so you'd have to go alert(state.attr(id)); Hope this helps. Also, I agree with Dave, this isn't the place for this kind of question. - Hide quoted text - - Show quoted text - On Wed, Dec 2, 2009 at 6:20 PM, Dave Methvin dave.meth...@gmail.com wrote: The jQuery-en group is a better fit for this question. This group is for the discussion of the development of jQuery itself. --
Re: [jQuery] SuperFish Menu
I looked and I don't see any superfish css or script. Alvin wrote: I used Superfish on other website (www.dapuri.com) and it works well. When I try to integrate it to this website, it doesn't work. Please click the link below and take a look (this is a testing page, ignore the standard menu on the left) http://www.avplannersinc.com/index.php/privacy-a-policy As you can see, only the title "Superfish menu" is shown, while the menu (MAIN MENU its SUBMENU) is not shown. I try to disable the Standard menu, disable the banner, etc but DIDN"T work. Any advice? Alvin Ooi
Re: [jQuery] Superfish: width of top level links - great with js off - too wide with js on
autoarrows: true this appends the link with a span with an arrow image to show links with subs and is adding addiitonal width, set to false Dasher wrote: Hello, I am setting up my first superfish menu and having an issue with the width of the top level link tabs. When _javascript_ is off, the width of the top level links look exactly how I want them - with flexible width to accomodate the link text and 7px padding either side. When _javascript_ is on, extra width seems to be added to the top level links - I am not sure what is causing it. It does get it right for the active state (which is wierd because there is no width for that in the css either). Here is a visual: http://www.gocreate.com.au/superfish-menu-spacing.jpg So what I am wanting to do is stop jquery / superfish adding extra width to the menu so that it looks the same with js on or off. The only widths mentioned in the css are as follows but changing these to "auto" does not have any effect on the width of the links: .sf-menu ul { position: absolute; top: -999em; width: 12em; } .sf-menu ul li { width: 100%; } My _javascript_ knowledge is very limited (I am a css'er) - with a bit of googling and the more user friendly nature of jquery, I found some tricks that I could try but as yet have been unable to solve it. My base code is as follows: $("ul.sf-menu").supersubs({ minWidth:8, maxWidth:13, extraWidth: 1 }).superfish(); $('ul.sf-menu').superfish({ delay: 1000, animation: {opacity:'show',height:'show'}, speed: 100, autoArrows: true, dropShadows: true }); $('ul.sf-menu li a span').remove(); // remove arrows from top level links The same thing happens with or without using the supersubs plugin. Adding this does reduce the width of each link but it makes all top level links the same width - so that's not suitable: $(".sf-menu li").css("width","100px"); Adding any of these variations do not seem to do anything (the idea being to reduce any width setting that jquery may 'secretly' be adding): $('ul.sf-menu li').css('width', ''); or $("ul.sf-menu li").css("width",""); or $('ul.sf-menu li')[0].style.width = ''; or $('ul.sf-menu li').style.removeAttribute("width", false); Then I thought maybe I could add a class to the top level links with jquery and set width:auto in the css for the class but that does not seem to solve it either: $("ul.sf-menu li").addClass("jq-wfix"); So now I am scratching my head... Any ideas? Thanks in advance.
Re: [jQuery] Can't get the js of superfish to work
jQuery undefined is typically caused by a path problem to jQuery.js, or you may be making calls to jquery before it is loaded ( jquery needs to load before any plugin files) also check that you only hae one copy of jquery loading webstudiolund wrote: I get these faults: jQuery is not defined hoverIntent.js()hoverIntent.js (rad 84) [Break on this error] })(jQuery);hoverIntent.js (rad 84) jQuery is not defined superfish.js()superfish.js (rad 121) [Break on this error] })(jQuery);\nsuperfish.js (rad 121) $("ul.sf-menu").superfish is not a function anonymous()halvskarp.html (rad 16) anonymous()jquery-1...6.minb.js (rad 27) anonymous()jquery-1...6.minb.js (rad 27) anonymous([function()], function(), Object name=args) jquery-1...6.minb.js (rad 21) anonymous()jquery-1...6.minb.js (rad 27) [Break on this error] $('ul.sf-menu').superfish(); \n
[jQuery] Possibly off topic: changing radiobuttons color
Hello everyone, Sorry for that but couldn't find anywhere else. We need to change the color of the radiobuttons. I mean, the circles that represent the buttons. Is it possible either via jQuery or CSS? And another question: we need also to change the color of the frame surrounding a combobox and of an arrow that is in there in the combobox... you see what I mean, I suppose (the select item). How can we do that? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule
[jQuery] Orkan star rating widget
Can get it, why this works: $(#stars-wrapper1).stars({ callback: function(ui, type, value) { $(#stars-wrapper1).stars(select, value); and this dont: $(#stars-wrapper1).stars(select, 3); Please my friends help with this. http://orkans-tmp.22web.net/star_rating/
[jQuery] is there a way to add a class to the body when window is resized below a certain width
is there a way to add a class to the body when window is resized below a certain width
Re: [jQuery] is there a way to add a class to the body when window is resized below a certain width
Of course you can! I'm actually working on something similar to that now. $(window).resize(function(){ reSize(); }); function reSize() { if ($('#page').width() 1000) { //do something } http://2whoa.com --- On Fri, 12/4/09, pab fliawebdes...@gmail.com wrote: From: pab fliawebdes...@gmail.com Subject: [jQuery] is there a way to add a class to the body when window is resized below a certain width To: jQuery (English) jquery-en@googlegroups.com Date: Friday, December 4, 2009, 9:39 PM is there a way to add a class to the body when window is resized below a certain width
[jQuery] jQuery 1.4 Alpha 1 Released
More details here: http://blog.jquery.com/2009/12/04/jquery-14-alpha-1-released/ --John
[jQuery] Change opacity for all divs except one
Hello all, I have a bunch of thumb nails that will be at full opacity when a user gets to the page. Users will be able to select their favorite. What I want to have happen is when a user selects their first favorite all of the there thumbnails will be lowered in opacity then when they select other favorites the opacity of that thumbnail will be brought to full. Each thumbnail is in a div. I am at a complete lose on how I can achieve this. Any help is greatly appreciated. If you need anymore info just ask. Thanks ins advance!
[jQuery] Can you limit selector to only search within current element?
I am pretty new to jQuery and I've dug through the documentation for a few hours and I haven't found the answer. I'm curious if you can limit a selector to only search within a defined div or other html tag. Below is the code with some notes so it should be pretty easy to understand but if not let me know and I can clarify. html head script type=text/javascript src=http://ajax.googleapis.com/ajax/ libs/jquery/1.3.2/jquery.min.js/script script type=text/javascript $(document).ready(function(){ $(a).click(function(event){ //Loop through each productGroup div $(.productGroup).each(function(i){ //Then for each div I'd like to loop through the uniqueIDs. $(select only the uniqueID in this productGroup div).each (function(i){ alert($(this).html()); }); }); event.preventDefault(); }); }); /script /head body a href=#Go!/a div class=productGroup div class=products span class=uniqueID1/span span class=uniqueID2/span span class=uniqueID3/span /div /div div class=productGroup div class=products span class=uniqueID4/span span class=uniqueID5/span span class=uniqueID6/span /div /div /body /html Thanks for the help, Jason
[jQuery] Simple modal plugin - problem with setting focus in modal window
Hi all, I have this weird problem I just can't find a way to solve. I'm using simpleModal plugin as login window and I want to set focus to username input upon window showing, but can't manage to do that. This is my code: $(#prijava_popup).modal( {opacity: 30, onOpen: function (dialog) { dialog.overlay.fadeIn(150, function () { dialog.container.slideDown(150, function () { dialog.data.fadeIn(150); }); }); $('div#simplemodal-container input[name=uime]').focus(); }, onShow: function (dialog) { $('div#simplemodal-container input[name=uime]').focus(); }); } }); But it doesn't work, I can hide input field but can't set focus to it. Is this solvable? Thank you in advance for your answer, best regards, Igor Benko
[jQuery] Re: Why mootools animations is more smooth than jquery?
ok, I've used some code I had lying around and put dummy content in there:http://www.tnt.be/bugs/jquery/moovsjquery/ I actually don't really see a difference on my Ubuntu box (using FF 3.6b4), but there's a huge difference on a colleague's G4 (OS X 10.4, Firefox 3.5.5), so try to find a slow computer to test this on. Jonathan, thanks for doing the demo. Pretty nice demo, by the way! I tried it on my system, but it's a fast Dell notebook running Windows 7. The demo ran smoothly on Firefox 3.5, IE8, Opera 10, and Chrome 3.
Re: [jQuery] Can you limit selector to only search within current element?
Hi, I think the following modification to your code will solve your purpose. $(document).ready(function(){ $(a).click(function(event){ //Loop through each productGroup div $(.productGroup).each(function(i){ //Then for each div I'd like to loop through the uniqueIDs. *$(this).find('div').* each(function(i){ alert($(this).html()); }); }); event.preventDefault(); }); }); Thanks Regards, Dhruva Sagar. On Sat, Dec 5, 2009 at 3:33 AM, TehNrd jason.vena...@gmail.com wrote: I am pretty new to jQuery and I've dug through the documentation for a few hours and I haven't found the answer. I'm curious if you can limit a selector to only search within a defined div or other html tag. Below is the code with some notes so it should be pretty easy to understand but if not let me know and I can clarify. html head script type=text/javascript src= http://ajax.googleapis.com/ajax/ libs/jquery/1.3.2/jquery.min.js/script script type=text/javascript $(document).ready(function(){ $(a).click(function(event){ //Loop through each productGroup div $(.productGroup).each(function(i){ //Then for each div I'd like to loop through the uniqueIDs. $(select only the uniqueID in this productGroup div).each (function(i){ alert($(this).html()); }); }); event.preventDefault(); }); }); /script /head body a href=#Go!/a div class=productGroup div class=products span class=uniqueID1/span span class=uniqueID2/span span class=uniqueID3/span /div /div div class=productGroup div class=products span class=uniqueID4/span span class=uniqueID5/span span class=uniqueID6/span /div /div /body /html Thanks for the help, Jason
Re: [jQuery] Change opacity for all divs except one
Have all the divs have a class name eg.) thumbs When the user selects his favorite remove this class name from the particular div and apply your opacity logic to $('div.thumbs'), so that way the favorite one would not be changed. Thanks Regards, Dhruva Sagar. On Sat, Dec 5, 2009 at 3:12 AM, Jared jhkersch...@gmail.com wrote: Hello all, I have a bunch of thumb nails that will be at full opacity when a user gets to the page. Users will be able to select their favorite. What I want to have happen is when a user selects their first favorite all of the there thumbnails will be lowered in opacity then when they select other favorites the opacity of that thumbnail will be brought to full. Each thumbnail is in a div. I am at a complete lose on how I can achieve this. Any help is greatly appreciated. If you need anymore info just ask. Thanks ins advance!
Re: [jQuery] Simple modal plugin - problem with setting focus in modal window
Perhaps you need to call focus() in the callback of fadeIn(150) ? Thanks Regards, Dhruva Sagar. On Sat, Dec 5, 2009 at 5:53 AM, Igor Benko igor.be...@gmail.com wrote: Hi all, I have this weird problem I just can't find a way to solve. I'm using simpleModal plugin as login window and I want to set focus to username input upon window showing, but can't manage to do that. This is my code: $(#prijava_popup).modal( {opacity: 30, onOpen: function (dialog) { dialog.overlay.fadeIn(150, function () { dialog.container.slideDown(150, function () { dialog.data.fadeIn(150); }); }); $('div#simplemodal-container input[name=uime]').focus(); }, onShow: function (dialog) { $('div#simplemodal-container input[name=uime]').focus(); }); } }); But it doesn't work, I can hide input field but can't set focus to it. Is this solvable? Thank you in advance for your answer, best regards, Igor Benko
Re: [jQuery] javascript variable scope
Cool, huh? This is one of the beauties and real powers of the JavaScript language. It's called a closure: https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Working_with_Closures - Richard On Fri, Dec 4, 2009 at 6:46 PM, cmonahan cmona...@yahoo.com wrote: This surprised me. I made the scenario as simple as possible. http://jsbin.com/eyopo3/edit You can see in function g() I change the value of the variable i after having used it. That may seem like a useless thing to do, but in the production code I was working on, i was a loop iterator. -- View this message in context: http://old.nabble.com/javascript-variable-scope-tp26648745s27240p26648745.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Re: [jQuery] listnav - how to implement paging
How do you picture paging working, from a UI perspective? -Jack prasad wrote: Hi, I like the 'jQuery ListNav Plugin' very much and i need to implement it in my application. I need to implement the paging functionality along with this plugin. If i have more than 100 rows for a character, its best to have a paging with it. Any help/sugestions on how to use this plugin along with paging?
Re: [jQuery] Share plugin
I recommend that you post a page about it, with a demo, add it to the jquery plugins directory and make an announcement on this list. I'd like to see what you've done, if you have it up somewhere. I find myself needing that often and have used various solutions with varying degrees of success. - Jack RiccardoC wrote: I just created a nice (at least I think it's nice :D ) plugin to make tables with scrollable body (tested on different browsers). I'm a bit new in the JQUERY community (hi to all!!) and I would like to ask all you where is the best way (and place) to share this plugin (the plugin use two div container added around the table element and 4 css rule definition) Thanks in advance
Re: [jQuery] drop down error
sounds like you aren't including superfish.css, modified it or this is a Joomla or other type of template that has preexisting menu css. The superfish css for all sub UL's is positioned offscreen not much anyone can do to help without a link test11 wrote: I am using superfish for dropdown menu.But during the page load before the image has been loaded all the drop down menus are getting visible.Can this be hide.please give me reply ASAP. Thanks in Advance
[jQuery] Re: Problem combining validation plugin and datepicker from ui (validate)
Hello all, I am using the JQuery validator from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ . And I am using the calendar component from YUI. The problem is similar to what bobbykjack has except I use YUI calendar. I have an input field ,when user clicks into it the calendar pops up. When user chooses a date it fills the input box. But the error message which had been displayed on clicking the submit button before the field was filled does not go away. How do I get rid off it?. I click into the field and then do a submit the message goes away ,submission happens . But not after the calender has populated it. Thanks in advance . Sucheta On Nov 19, 8:53 pm, bobbykjack bobbyj...@gmail.com wrote: OK, my requirement is wildly advanced, but I need to combine theui datepicker with the validation plugin. Ultimately, I need to ensure a date is at least 1 month in the future. The problem I'm encountering is the exact ordering of events. It appears as if the validator check's the input's data before the datepicker has written to it (after a date has been picked). There's a demo here:http://www.fiveminuteargument.com/jquery-validation-date-picker.html and you should notice the problem (the date 'seen' lagging behind by one) once you've picked the second date, and onwards. Any advice much appreciated, - Bobby
Re: [jQuery] drop down error
Hi i have already added the superfish.css.Untill the image is getting loaded all the dropdown list r getting visible.Once the image has been loaded the superfish is working fine.can u suggest me to hide the drop drop menu before the image has been loaded. Charlie Tomlinson wrote: sounds like you aren't including superfish.css, modified it or this is a Joomla or other type of template that has preexisting menu css. The superfish css for all sub UL's is positioned offscreen not much anyone can do to help without a link test11 wrote: I am using superfish for dropdown menu.But during the page load before the image has been loaded all the drop down menus are getting visible.Can this be hide.please give me reply ASAP. Thanks in Advance -- View this message in context: http://old.nabble.com/drop-down-error-tp26635792s27240p26653106.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: is there a way to add a class to the body when window is resized below a certain width
yeah figured it out few minutes after posting, thanks On Dec 4, 9:44 pm, ripple ripple...@yahoo.com wrote: Of course you can! I'm actually working on something similar to that now. $(window).resize(function(){ reSize();}); function reSize() { if ($('#page').width() 1000) { //do something} http://2whoa.com --- On Fri, 12/4/09, pab fliawebdes...@gmail.com wrote: From: pab fliawebdes...@gmail.com Subject: [jQuery] is there a way to add a class to the body when window is resized below a certain width To: jQuery (English) jquery-en@googlegroups.com Date: Friday, December 4, 2009, 9:39 PM is there a way to add a class to the body when window is resized below a certain width
Re: [jQuery] Is possible to update two div with the same load?
I resolved my problem using callback. I put the second load in the callback function of first one. Thanks for your answer. 2009/12/4 Michel Belleville michel.bellevi...@gmail.com Well it depends ; most of the times you end up loading a big bit of data that should replace a specific portion of the screen (let the standard .load() behaviour do the heavy lifting for this one) plus a few tidbits like notifications and so on that are secondary (can be dealt with in the callback), so your code is just a little bit more expressive (the main purpose of the query is expressed first in the .load() mandatory parameters, then the secondary tidbits are placed later in the callback). Using .get() would also do the job, but would be slightly less readable later. Michel Belleville 2009/12/4 Richard D. Worth rdwo...@gmail.com I think you're better of with $.get and then doing the finding and loading into both divs yourself. - Richard On Fri, Dec 4, 2009 at 5:21 AM, NMarcu marcu.nico...@gmail.com wrote: Hi, I need to update a div that contain a table, and another one that contain a drop down list, that is build depending on what is in one table from db(the first div depend on this also). It's possible to update the 2 divs with the same load, or need to use two load. I try this but not worked correct. Thanks. -- All the best, Nicolae MARCU
[jQuery] Content loaded via Ajax and global JS
This probably isn't a jquery question precisely, but jquery is being used as my method for making ajax requests. I'm running into a recurring problem where functions declared on the initial page load aren't manipulating content loaded later via ajax. For example, when the page loads I may have two .button elements but then I pull in three more via ajax. A function that affects that .button class will work on the original elements but not the ones added via ajax. Here is a very basic but functional example of this: -- script type=text/javascript $(function() { $('p').click(function() { $.ajax({ url : 'testing.html', type: 'get', success : function(data) { $('.container').append(data); } }); }); }); /script div class=container pHello/p /div -- In this example, a click of any p tag should append the content from testing.html onto the doc. testing.html is a fragment that has a duplicate p tag. Well, I want every new p tag to have the same behavior as the original one. How do I do that? I've found that putting that writing that function into the fragment can solve the problem but this isn't the sort of solution I'm looking for. Sometimes, redeclaring the function in the success function will work as well, but this is inelegant as I'd like any function declared in the site js file to be available. What is a good method for getting around this sort of trouble? Thanks