[jQuery] Re: The University of Murcia (Spain) takes jQuery as main JS Library for all new projects
Jörn Zaefferer escribió: SeViR schrieb: Somewhere in the documentation you should find a comment stating that the temptation to add a regex method is great, but should be resisted. I still think that its better to add custom methods that implement those regular expression instead of one generic regex method. By choosing a good name for the method its very clear what is validated, which is not easily figured by looking at a complex regular expression. And heavily increases the chance to reuse regular expressions. mmm, I don't know if I think the same... On one side, a generic regexp method allow less code and fast rule writing, on the other side, you are right, an specific method with a good name is more clear. I haven't understood yet how implies works, but your code seems like a good approach to tackle that feature. Thanks. Logical implies a = ba is true if b is true, false in other case. Then this is a simple example form: (* is obligatory) *name: ___ *surname: send by postal mail: [X] -- checkbox postal address: ___ So, if I check send by postal mail, implies that I need the postal address, but I can write the postal address for more information without mark the checkbox :) The and and or method also is useful for dependences between fields. -- Best Regards, José Francisco Rives Lirola sevir1ATgmail.com SeViR CW · Computer Design http://www.sevir.org Murcia - Spain
[jQuery] Re: Memory problem
Hi, I see the problem, now. The array jQuery.event.global is getting bigger and bigger. For a long running Web application (without any page refresh) it is a strange problem. If I have removed an event and then will delete the element (the DOM element) this should be removed from the jQuery.event.global array. If I press F5 it will clear nearly everything and memory usage is like before. Michael On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote: Sorry, I forgot to mention that I'm using Internet Explorer 6 on Windows XP. With other web browser I don't see any problem. The example above will grow with every re-render. Michael On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote: Michael, The example works for me - what's the problem? rob. On 4/19/07, Michael Schwarz [MVP] [EMAIL PROTECTED] wrote: Hi, I have a very simple page which will be refreshed from time to time. I build an example which will be called every 1000 msec to redner a html table with a button inside. The button click event is set with the bind method. What I'm doing wrong? Regards, Michael div id=display /div script type=text/javascript function clickhandler() { alert(clicked); } function render() { var d = new Date(); var n = d.getTime(); $(button).unbind(click, clickhandler); var sb = []; sb.push(table); for(var i=0; i100; i++) { sb.push(trtd + i + /tdtd + n + /tdtdbuttonClick/ button/td/tr); } sb.push(/table); $(#display).html(sb.join('')); $(button).bind(click, clickhandler); setTimeout(render, 1000); } $(window).ready(render); /script -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome. -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED] -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED]
[jQuery] Re: Erratic behavior of cookie plugin
Jörn Zaefferer schrieb: Ⓙⓐⓚⓔ schrieb: / for a path is great. every page will share the cookies, KLAUS Jörn, wouldn't it be a nice default? This is server wide cookies. If you added a domain .example.com You have all 'subhost' cookies. If you added a domain example.com http://example.com You have domain wide cookies. the 2 last are often mixed up and there is very little difference! BUT old cookies for /test would still be visible to a page under /test like /test/xyz.html I hope you never have to clean up your team's crummy cookie remains! Seems like that would solve a lot of the problems with cookies. I'm planning a few additions to the cookie plugin anyway. Klaus? With this as a default if you want to use the cookie default again (path of page that created the cookie), you'd have to code something like the following which is not intuitive at all: $.cookie('name', 'value', { path: null }); I'd really prefer to rely on the existing defaults here. It should be up to the programmer to take care of these important details. -- Klaus
[jQuery] Re: Memory problem
Hi, I added some lines to the remove function (line 1245): // original if(!k) element[on + type] = null; // changed to if (!k) { element[on + type] = null; for ( var i=0; ithis.global[type].length; i++) { if(this.global[type][i] == element) { this.global[type].splice(i, 1); break; } } } I see that the for loop isn't very well, maybe there is another way to remove the element if there is no handler. Michael On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote: Hi, I see the problem, now. The array jQuery.event.global is getting bigger and bigger. For a long running Web application (without any page refresh) it is a strange problem. If I have removed an event and then will delete the element (the DOM element) this should be removed from the jQuery.event.global array. If I press F5 it will clear nearly everything and memory usage is like before. Michael On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote: Sorry, I forgot to mention that I'm using Internet Explorer 6 on Windows XP. With other web browser I don't see any problem. The example above will grow with every re-render. Michael On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote: Michael, The example works for me - what's the problem? rob. On 4/19/07, Michael Schwarz [MVP] [EMAIL PROTECTED] wrote: Hi, I have a very simple page which will be refreshed from time to time. I build an example which will be called every 1000 msec to redner a html table with a button inside. The button click event is set with the bind method. What I'm doing wrong? Regards, Michael div id=display /div script type=text/javascript function clickhandler() { alert(clicked); } function render() { var d = new Date(); var n = d.getTime(); $(button).unbind(click, clickhandler); var sb = []; sb.push(table); for(var i=0; i100; i++) { sb.push(trtd + i + /tdtd + n + /tdtdbuttonClick/ button/td/tr); } sb.push(/table); $(#display).html(sb.join('')); $(button).bind(click, clickhandler); setTimeout(render, 1000); } $(window).ready(render); /script -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome. -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED] -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED] -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED]
[jQuery] Re: Keyboard shortcuts
Yes i've ported this to jQuery, i'll add it to SVN tonight. It has thesame options as the keyboard_shortcuts, but i've improved (cleaned up) the code a lot. You can bind any combination you want.
[jQuery] Accordion plugin: how to keep nested lists open?
Hi everyone, I am new to all this, and need a simple bit of help using the a href=http://bassistance.de/jquery-plugins/jquery-plugin- accordion/Accordion plugin/a. It is working fine - my html is standard nested lists, used as navigation, however, when a child list item within a nested list is clicked, the list closes, thus hiding all the other links within the nested list. I would like it to stay open until another parent list header is clicked. That would make browsing easy for the user. Any help is greatly appreciated. I am assuming you might be able to help me modify the applicable lines of the plugin. Many many thanks.
[jQuery] Re: Using EXT with Jquery
HI Eli, I spotted this too - and had a play with Ext and jQuery - though I couldn't really see how the two were supposed to be linked together. I did get the same error as you, but it was because I hadn't set up the underlying HTML properly, i.e. I was telling my page to target 'yui-north' instead of the ID that was on my HTML. If you can post a URL to the version you're working on it might be easier to debug. In the mean time, I'll knock up an example using the layout manager and the jQuery library and do a follow up post. On Apr 20, 12:25 am, Eli [EMAIL PROTECTED] wrote: Hey guys, Just noticed a couple of days ago that ext now has a new 'extjs' for jquery, and I wanted to test it out, but for some reason I can't get it to work. I've tried to make my own page like the layout.js example (http://extjs.com/deploy/ext/examples/dialog/layout.html), and I get the following error in the firebug console: el has no propertieshttp://dalog.eli.com/javascript/ext/ext-all.js Line 127 my script load the next file: javascript/jquery.js javascript/ext/adapter/jquery/jquery-plugins.js javascript/ext/adapter/jquery/ext-jquery-adapter.js javascript/ext/ext-all.js in the same order as the list above. Any ideas why my script failing?
[jQuery] Re: Tabs plugin: Is there a way to trigger a tab with a URL to load?
I've managed to modify the tabs code to allow you to send a new URL to the tab to be executed. Here's a diff: Compare: ()Original\jquery.tabs.js with: ()Modified\jquery.tabs.js 356c358,362 // if the tab is already selected or disabled or animation is still running stop here --- var tgt = arguments[1] || false; // if the tab is already selected or disabled or animation is still running stop here if( !tgt ) { 361a367 } 387c394 $(this).trigger('click'); --- !tgt ? $(this).trigger('click') : $(this).trigger('click', [tgt]) ; 427a434,435 var tgt = arguments[1] || false; 430,435c439,452 // if onClick returns false, the tab is already selected or disabled or animation is still running stop here if ((typeof onClick == 'function' onClick(this, toShow[0], toHide[0]) == false trueClick) || container.locked || li.is('.' + settings.selectedClass) || li.is('.' + settings.disabledClass)) { this.blur(); return false; } --- if( !tgt ) // if we've not passed a new target { // if onClick returns false, the tab is already selected or disabled or animation is still running stop here if ((typeof onClick == 'function' onClick(this, toShow[0], toHide[0]) == false trueClick) || container.locked || li.is('.' + settings.selectedClass) || li.is('.' + settings.disabledClass)) { this.blur(); return false; } } else { remoteUrls[clicked.hash] = tgt; } 589c606 return function(tab) { --- return function(tab, tgt) { 599c616 a.trigger(tabEvent); --- a.trigger(tabEvent, [tgt]); To use: $('#tabs').triggerTab(2, 'http://mysite.com/mypage.html'); One benefit is that the tab remembers its new target, so when its clicked you get the same page again, rather than the one set by default. Its probably a terrible hack, but it works for now. I hope you decide to add this feature in your next release, its extremely useful. HTH Phill -- On Apr 18, 3:28 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Phillip B Oldham schrieb: I'd like to be able totriggeratabusing the following format (or something similar): $('#container').triggerTab(3, 'http://mysite.com/updates.html'); The second parameter is aURLI'd like toload, which can change depending on user input. Is this possible? No it isn't. RemotetabURLs are static so far... -- Klaus
[jQuery] Re: Using EXT with Jquery
As promised: http://remysharp.com/wp-content/uploads/2007/04/ext_layout.html
[jQuery] Re: .change doesn't match cloned elements?
Thanks for the replies. With that plugin I was able to solve it. :D So now it is working great: http://members.home.nl/mavdude/jquery/fixed.html On Apr 20, 5:38 am, Karl Swedberg [EMAIL PROTECTED] wrote: If you want to clone events along with new DOM nodes, you can try Brandon Aaron's Copy Events plugin:http://www.learningjquery.com/2007/01/copy-events-from-one-element-to- another --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 19, 2007, at 10:59 PM, Ⓙⓐⓚⓔ wrote: I think I understand... change is a event bind, and event binds don't get cloned. so you have to re-bind or re-make the nodes and re-bind anyway. it's an idea, not a solution. I always bind my new nodes. On 4/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Did I find a bug, or is there just nobody that knows how to fix it? On Apr 19, 1:43 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm trying to get flexible (array) select boxes in a form working, but i'm having some troubles with the cloned ones. The end-use idea is to auto-populate the second selectbox, after the first one has been changed. To do this, I need to match only the first selectbox ofcourse. And this works, but just for the first one. If you add a new line of selectboxes (by cloning the original), it doesn't match the first box of that as it does with the original. But, and this is the thing that puzzles me, if you use the original first box it does tell you in the popup that there are a total of # select boxes. Which is using the exact same selector. It's hard to explain, so here's a test example: http:// members.home.nl/mavdude/jquery/ Any idea or suggestion is welcome. Thanks, Mav -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: manipulating TEXAREA content
Dug, As you may have guessed, I'm not a developer, I'm an IA. The developers are telling me this isn't possible and I figured if it were, the folk on this list would be able to say. So if I understand correctly, by the sound of it, this should be possible:-) You all had concerns about usability and make some very good points. What I am trying to do is make the counter go away altogether. Visually, the characters at the end of the textarea input are very light grey and are almost invisible. The plan is to do this for a few few months then remove it altogether. Here's a gif of the interface in rough form (brackets not to be orange, that was the design guy adding bells and whistles as usual) http://www.donkeyontheedge.com/dev/i/OM2_2_writeSMS-story.gif For the amount of work it would take to try to get it work like you have it in the GIF (especially considering this is a temporary idea) I'd move the character count below the text box in the grey border to the right. You could whip that code out in 2 minutes. Trying to place a floating DIV where the caret is currently positioned will be extremely difficult--and at best just a guess. I don't ever recall seeing any method that will give you an X/Y coordinator for the caret in an input box. You can detect where in the input stream the cursor is (as in 300th character position,) but I don't remember ever seeing anything that will give you a pixel coordinate. -Dan
[jQuery] Re: Memory problem
Michael, I went ahead and created a ticket for this so that it doesn't get lost in the archives. http://dev.jquery.com/ticket/1136 -- Brandon Aaron On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote: Hi, I added some lines to the remove function (line 1245): // original if(!k) element[on + type] = null; // changed to if (!k) { element[on + type] = null; for ( var i=0; ithis.global[type].length; i++) { if(this.global[type][i] == element) { this.global[type].splice(i, 1); break; } } } I see that the for loop isn't very well, maybe there is another way to remove the element if there is no handler. Michael On 4/20/07, Michael Schwarz [EMAIL PROTECTED] wrote: Hi, I see the problem, now. The array jQuery.event.global is getting bigger and bigger. For a long running Web application (without any page refresh) it is a strange problem. If I have removed an event and then will delete the element (the DOM element) this should be removed from the jQuery.event.global array. If I press F5 it will clear nearly everything and memory usage is like before. Michael On 4/19/07, Michael Schwarz [EMAIL PROTECTED] wrote: Sorry, I forgot to mention that I'm using Internet Explorer 6 on Windows XP. With other web browser I don't see any problem. The example above will grow with every re-render. Michael On 4/19/07, Rob Desbois [EMAIL PROTECTED] wrote: Michael, The example works for me - what's the problem? rob. On 4/19/07, Michael Schwarz [MVP] [EMAIL PROTECTED] wrote: Hi, I have a very simple page which will be refreshed from time to time. I build an example which will be called every 1000 msec to redner a html table with a button inside. The button click event is set with the bind method. What I'm doing wrong? Regards, Michael div id=display /div script type=text/javascript function clickhandler() { alert(clicked); } function render() { var d = new Date(); var n = d.getTime(); $(button).unbind(click, clickhandler); var sb = []; sb.push(table); for(var i=0; i100; i++) { sb.push(trtd + i + /tdtd + n + /tdtdbuttonClick/ button/td/tr); } sb.push(/table); $(#display).html(sb.join('')); $(button).bind(click, clickhandler); setTimeout(render, 1000); } $(window).ready(render); /script -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome. -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED] -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED] -- Best regards | Schöne Grüße Michael Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer http://weblogs.asp.net/mschwarz/ http://www.ajaxpro.info/ Silverlight: http://groups.google.com/group/wpf-everywhere/ Ajax.NET Professional: http://groups.google.com/group/ajaxpro/ Skype: callto:schwarz-interactive MSN IM: [EMAIL PROTECTED]
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: Is there a fool-proof way to determine if a user has Javascript enabled in their browser? From the server side? No. From the client? Just try it. Often, the trick is to make the site function reasonably even if JS is off. One ugly technique that I've used on occasion is to have an initial page with some JS that changes all links and forms to tell the server that from now on, it can assume that JS is on. But if the user turns off JS in the middle of using my site, this fails miserably. And if there are multiple entry points (bookmarks anyone?) it would have to be done on multiple pages. It's not fun. I suppose that AJAX-y methods would make this a bit easier now, but I would not ever recommend this technique. Instead, I would simply make sure that the site works, even if more awkwardly, without JS and then have the JS dynamically make whatever changes are needed to make the pages sexier. -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
From where? If javascript runs, they have it enabled - if it doesn't, they don't! Are you wanting to pass this information to your server? Something like the following should work for that: a id='js_detect' href='/foo.php'Load/a script type='text/javascript'!-- $(document).ready(function() { var href = $(#js_detect).attr(href); href += ?javascript=true; $(#js_detect).attr(href, href); }); // -- /script If the user doesn't have javascript or it's not enabled, the href won't be changed. HTH, rob On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Simple way to do it might be to use javascript itself to do a forward or something like that. I've seen people set up a meta refresh of 5 seconds in the header, then use javascript to do a location.href as soon as the page loads. If they have js, they get redirected immediately to page A, if they don't, then after 5 seconds, they get redirected to page B. Thoughts? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 7:57 AM To: jquery-en@googlegroups.com Subject: [jQuery] Best way to determine if a user has Javascript enabled? Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Well said, Dan. On 4/20/07, Dan G. Switzer, II [EMAIL PROTECTED] wrote: As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
One thing to point out about mine and Dan's suggestion is that your Seach engine ranking will take a hit if you use this method. Google penalizes sites who use redirects to other pages. Depending on why you need to check for JS, you might consider using this method only for portions of the site which will not receive search engine hits. Such as admin areas, online forms, etc. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 8:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Hi, Dan... and thanks for the feedback... What I would like to do is allow ColdFusion server-side validation messages to be delivered back to the form page via Ajax if JS is available and, if not, just refresh the page. Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? Rick Your code: !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / cfelse !---// reload mailing list page, which will show any errors //--- cfinclude template=#form.formUrl# / cfexit method=exitTemplate / /cfif -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 9:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Using EXT with Jquery
Never mind. Checked it in FF. Pretty cool. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Eli Sent: Friday, April 20, 2007 8:37 AM To: jQuery (English) Subject: [jQuery] Re: Using EXT with Jquery Thanks all of you, especially Remy, I managed to solve my problem, this http://remysharp.com/wp-content/uploads/2007/04/ext_layout.html helped me a lot mate, thanks :) On Apr 20, 2:06 pm, Remy Sharp [EMAIL PROTECTED] wrote: I also wrote up a short article on my initial play with Ext and the mistakes I made (it also includes a link the jquery-plugins.js file that Juha points out is missing): http://remysharp.com/2007/04/20/jquery-ext/
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the info, Rob. The purpose here is to determine how my server-side form validation results will be sent back to the form page. If JS is enabled, then I can use Ajax to send them back, if not, then the page will have to be refreshed. This is very important for forms that are embedded in the middle of a page where refreshing the page would cause the user to have to scroll back down to the form to see the results if a refresh is used. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rob Desbois Sent: Friday, April 20, 2007 9:14 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? From where? If javascript runs, they have it enabled - if it doesn't, they don't! Are you wanting to pass this information to your server? Something like the following should work for that: a id='js_detect' href='/foo.php'Load/a script type='text/javascript'!-- $(document).ready(function() { var href = $(#js_detect).attr(href); href += ?javascript=true; $(#js_detect).attr(href, href); }); // -- /script If the user doesn't have javascript or it's not enabled, the href won't be changed. HTH, rob On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick -- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 There's a whale there's a whale there's a whale fish he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth schrieb: If JS is enabled, then I can use Ajax to send them back, if not, then the page will have to be refreshed. If you use JavaScript in the sense of Progressive Enhancement, this should be no problem at all. First build your form working in the traditional way, afterwards you plug JavaScript on top and improve the user experience. In case JS is disabled, everything still works fine. -- Klaus
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. I think this is going to be difficult, if you are trying to drive it from the server-side. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. But the server is not choosing whether it can refresh part of a page. It's simply responding to a request. If the request asks for the data needed to refresh part of the page, then it should send just that data. If the request is a form submission, the browser won't be ready to handle just the validation data; it's expecting a whole page. So the server must supply a whole page at that point. It's relatively straightforward to progressively enhance the page to convert a submit form request into an initial AJAX validation request, followed by either error reporting or actual form submission. The harder part is to determine how to deal with this server side. Basically, you want a component model server side that can do several different things dependent upon how the request is made: serve the form as part of the initial page, serve the form back in the page with validation messages, or return the validation messages in response to an AJAX request. My biggest question with my server-side code is how to make sure these three related tasks are handled efficiently without code duplication. Cheers, -- Scott Sauyet
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, That would work if the form were visible when the page is first opened, (And I may have to go that route if what I'm trying doesn't work...), but when the page is first opened, the form is invisible and a link has to be clicked to even view the form. So a named anchor wouldn't provide *exactly* what I'm looking for, but may be a compromise. Well, if you're doing that then you're requiring JS to even fill out the form to begin with. If that's the case, then you can just use JS to show the form and move to the anchor. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / Don't pay too much attention to the ex2_process.cfm in the example. It's used for all of the ex2.1*.cfm templates. For the ex2.3_mailing_list_validation.cfm example, the code above would *never* be executed. I just sent another message that hopefully will clear things up for you. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the feedback, Rey. I'm feel certain that the feedback I'm getting will be correct. I just wanted to ask the questions to be sure. Dan's demo code caused me a lot of confusion, because it seemed to be doing exactly what I'm looking for. I'll try one more approach and that is (as I've done already) to display server-side validation messages via taconite, but if that should fail (and I'll have to figure out some way to flag that failure) have CF goes ahead and display the messages as I've done for years. I'm sure you can all excuse a newbie to JS in general and jQuery in particular for exploring the boundaries of what is possible! :o) Thanks for your patience. Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rey Bango Sent: Friday, April 20, 2007 10:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Hi Rick, Let me summarize what everyone is saying before this turns into a long thread. Basically, there's no easy and surefire way of determining if JS is enabled on the browser. You need to code your forms and pages in the traditional way that you would any non-JS application. Once you have those pages working correctly with proper server-side validation and handling, then you can look at progressive enhancement to extend the functionality of your pages by leveraging JS, DOM-manipulation and Ajax. I realize that you're trying to find a way of doing this from a server-side perspective but you're going to end up building a hodge-podge solution that will not be effective. You have some really sharp people giving you the right advice and since I want you to be successful, I highly recommend that you follow their suggestions. This is the *only* surefire way of ensuring that browsers that have JS disabled will work properly on your site. Otherwise, its a shot in the dark. Rey... Rick Faircloth wrote: That's what's motivating the question. I'm trying to take Progressive Enhancement, as I see it, one step further by integrating the enhancement into the server-side process, where possible and applicable. This part concerns return validation result messages back to the form page, or rather back to the page itself, since I'm currently posting the form back to the page its own. If JS is disabled, then I would simply have to refresh the page. If JS is enabled, then I could use taconite to place messages on the page without refresh...if I'm understanding everything correctly. Rick
[jQuery] Re: Superfish, Tabs and IE z-index
On 21/04/2007, at 12:43 AM, Chris Scott wrote: I'm using Superfish for my menus and the Tabs plugin. By default, the Superfish menus show up behind the tabs. The Tabs css uses a z- index of 2 so I set the Superfish css to use a z-index of 3. This works in FF and the menus show up in front of the tabs. However, IE doesn't play nice and the menus show behind the tabs. Has anyone come across this and have a fix? I'm using the bgiframe option in Superfish for the menus if that matters. I don't have the code posted right now since this is on a private system but I can work up a demo page if it would help. Thanks. -- Chris Scott Hi Chris. I'd love to help you out. It's 1.30am here but I'll have a look at your problem tomorrow or ASAP if no-one else has solved it by then. If you could create a demo page that would definitely help resolve this easier and quicker. Joel Birch.
[jQuery] What is wrong with this code
Hi this is what I have jQuery.get(item_link,function(item_content){ var new_content = jQuery(item_content).filter(#contentpane .contentpane p).eq(0); jQuery(#myContent).html(new_content).slideDown(slow); }); What I imagine this code should be doing is extract the first paragraph from the item_content and fill the #mycontent with this first paragraph. But what I get it nothing in this #mycontent. Can someone please point me to what I am I doing wrong. I intent to extract the first paragraph from #contentpane .contentpane element. thanks
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? Since it's obvious that you've downloaded my presentation, I need to point out that some of the things in the demo are bad concepts, but I did them to show the progression of how you get from point A to point D. For example, the ex2.4_mailing_list_ajax.cfm is a horrible idea for validation. For my presentation though, I wanted to isolate the portion that should how one could validate against server-side lookups. The final goal was to get to ex2.5_mailing_list_validation_ajax.cfm. This template shows using pure client-side validation to validate absolutely everything you could on the client-side, while using AJAX only when you couldn't validate w/out looking something up on the server. It also shows how all the JS code in unobtrusive and the form still works without JS. So, whatever you do, you should not use ex2.4_mailing_list_ajax.cfm as a model for validation--it would be taken out of context and be a very bad implementation. For those of you interested in the presentation files, you can download it here: http://blog.pengoworks.com/blogger/index.cfm?action=blog:585 -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. I got that, but the code seems to test for Ajax availability, and if there's been an Ajax call, it responds with messages via Ajax. If the call was not via Ajax, then the validation responses are returned via template inclusion, rather than refresh, which worked for the purposes of your demo, but I'm not sure how that technique would work on a real website. But if I'm wrong about my explanation above, please explain to me what your code does: !---// if this is an AJAX call, we must return JSON data //--- cfif structKeyExists(url, ajax) and url.ajax !---// clear all generated data //--- cfcontent type=text/xml reset=true / cfoutput{ success: #stAction.success#, message: #jsStringFormat(stAction.message)# [AJAX] }/cfoutput cfexit method=exitTemplate / -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 10:07 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick, Isn't that what you do with this code is your ex2.3_mailing_list_validation.cfm example for the ex2_process.cfm page? That page has no AJAX based validation. I also do no JS detection. The code is set up so that if JS is unavailable, the form just works. -Dan
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Beat me to it. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Friday, April 20, 2007 8:19 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Simple way to do it might be to use javascript itself to do a forward or something like that. I've seen people set up a meta refresh of 5 seconds in the header, then use javascript to do a location.href as soon as the page loads. If they have js, they get redirected immediately to page A, if they don't, then after 5 seconds, they get redirected to page B. Thoughts? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 7:57 AM To: jquery-en@googlegroups.com Subject: [jQuery] Best way to determine if a user has Javascript enabled? Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? Rick
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for pointing that out, Andy. That's important for me to know, because I not only design and develop sites for clients, more and more are asking me to perform SEO/SEM for them and I don't want to hurt their rankings, for sure! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andy Matthews Sent: Friday, April 20, 2007 9:37 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? One thing to point out about mine and Dan's suggestion is that your Seach engine ranking will take a hit if you use this method. Google penalizes sites who use redirects to other pages. Depending on why you need to check for JS, you might consider using this method only for portions of the site which will not receive search engine hits. Such as admin areas, online forms, etc. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dan G. Switzer, II Sent: Friday, April 20, 2007 8:16 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick, Good morning, all... Is there a fool-proof way to determine if a user has Javascript enabled in their browser? As discussed on another mailing list, there's no real need to detect if JS is enabled. If you write unobtrusive JavaScript (which is what jQuery helps you to do) if the user has JS disabled, things will continue to work. There's no reason to have separate JS/non-JS pages in most cases--especially for the kind of things you're working on. That said, the most full proof way I'm aware of to test if JS is enabled/disabled is driving traffic through a splash page which does a redirect. meta http-equiv=refresh content=2;url=page.htm?js=false script type=text/javascript self.location = page.htm?js=true; /script In this example if JS is enabled, the JS code would be executed redirecting the user to page w/a URL parameter indicating that JS was enabled. If the JS code doesn't execute, then the meta refresh would take over. However, I can't emphasis this enough, testing for JS is really unnecessary for all the work you've been talking about. You keep saying you want to make your code easier to manage and develop and detecting for JS in this case is just adding more complexity. It's much easier to just write the JS and if it doesn't execute then let the server-side code re-enforce the behavior. The last time I wrote any kind of detection script, was for a project that required Flash. It's been 9 years since I've written a script to detect for JS--and that was because I didn't know better. -Dan
[jQuery] Re: Using EXT with Jquery
I also wrote up a short article on my initial play with Ext and the mistakes I made (it also includes a link the jquery-plugins.js file that Juha points out is missing): http://remysharp.com/2007/04/20/jquery-ext/
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Rick Faircloth wrote: The simplest thing is just to add a post parameter that says ajaxOn=true or some such, then check for that server-side. It wasn't included in the HTML, or it was set to false, so if it's true, the server knows to respond with an AJAX request. It's pretty straightforward. Well, then, wouldn't that amount to a fool-proof test that Ajax is available for the server to use as a response mechanism? Yes, that's what a number of people have been trying to tell you. There is no useful way for the server side to determine if JS is on, but the client side can easily *tell* that to the server side. And I assume by add a post parameter, you mean a hidden field in the form or somewhere in the JS code on the calling page with a variable? Yes, although it could also be done through a parameter added to the query string or the URL, depending upon how you want to handle it server side. But the other option, suggested on this thread, to use the HTTP header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery for a while. Good luck, -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
The only question now is whether or not HTTP_X_REQUESTED_WITH is compatible with ColdFusion 4.5... the client side can easily *tell* that to the server side It doesn't really matter how the server-side knows, as long as it knows :o) And a question about adding it to a URL... how does the client-side page determine whether JS is available or not before any code is executed? What's the means of determine wither to add .cfm?Ajax=False or .cfm?Ajax=True ? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Scott Sauyet Sent: Friday, April 20, 2007 11:50 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Rick Faircloth wrote: The simplest thing is just to add a post parameter that says ajaxOn=true or some such, then check for that server-side. It wasn't included in the HTML, or it was set to false, so if it's true, the server knows to respond with an AJAX request. It's pretty straightforward. Well, then, wouldn't that amount to a fool-proof test that Ajax is available for the server to use as a response mechanism? Yes, that's what a number of people have been trying to tell you. There is no useful way for the server side to determine if JS is on, but the client side can easily *tell* that to the server side. And I assume by add a post parameter, you mean a hidden field in the form or somewhere in the JS code on the calling page with a variable? Yes, although it could also be done through a parameter added to the query string or the URL, depending upon how you want to handle it server side. But the other option, suggested on this thread, to use the HTTP header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery for a while. Good luck, -- Scott
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Scott Sauyet [mailto:[EMAIL PROTECTED] header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery This sounds like the best way - I think you were using CF right? Maybe try: GetHttpRequestData Description Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header. As far as populating the hidden form field - I got this code from Dan's autocomplete example: function findValue(li) { if( li == null ) return alert(No matching records found!); // if coming from an AJAX call, let's use the CityId as the value if( !!li.extra ) var sValue = li.extra[0]; // otherwise, let's just display the value in the text box else var sValue = li.selectValue; // write the id to a hidden field $(#public_id).val(sValue); } It's basically looking for a value in a list and assigning that to my field (public_id) Jim
[jQuery] Re: What is wrong with this code
Thanks for the reply Brian, I tried your way but didn work. I looked at the docs again and it says it should be like this jQuery(item_content).filter(#contentpane .contentpane p, :first); But unfortunately this also did not work. As for th cloning of node, Well I am novice to javascript and have never used it before, infact don't know how to use this function. Thanks again. Please do write if you have any more suggestions. On Apr 20, 11:45 am, Brian Miller [EMAIL PROTECTED] wrote: Quick-n-dirty way: use .eq(0).innerHTML instead of .eq(0) . But, what might probably work better is if you cloned the node and inserted it into #myContent (assuming that it winds up as valid DOM that way). - Brian Hi this is what I have jQuery.get(item_link,function(item_content){ var new_content = jQuery(item_content).filter(#contentpane .contentpane p).eq(0); jQuery(#myContent).html(new_content).slideDown(slow); }); What I imagine this code should be doing is extract the first paragraph from the item_content and fill the #mycontent with this first paragraph. But what I get it nothing in this #mycontent. Can someone please point me to what I am I doing wrong. I intent to extract the first paragraph from #contentpane .contentpane element. thanks
[jQuery] disabling right click
How I can disable right click on perticular element or div using jQuery. --- Sharique
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Gotcha... (Hopefully it's compatible with CF 4.5!) Your approach looks like what Dan did in his presentation code: cfif structKeyExists(url, ajax) and url.ajax Checking for the ajax variable in the url struct... at least that's how I'm understand it... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 11:56 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Scott Sauyet [mailto:[EMAIL PROTECTED] header HTTP_X_REQUESTED_WITH means no extra work in the JS, and is probably a better idea, as long as you are sure you will be using JQuery This sounds like the best way - I think you were using CF right? Maybe try: GetHttpRequestData Description Makes HTTP request headers and body available to CFML pages. Useful for capturing SOAP request data, which can be delivered in an HTTP header. As far as populating the hidden form field - I got this code from Dan's autocomplete example: function findValue(li) { if( li == null ) return alert(No matching records found!); // if coming from an AJAX call, let's use the CityId as the value if( !!li.extra ) var sValue = li.extra[0]; // otherwise, let's just display the value in the text box else var sValue = li.selectValue; // write the id to a hidden field $(#public_id).val(sValue); } It's basically looking for a value in a list and assigning that to my field (public_id) Jim
[jQuery] Re: disabling right click
On Friday, April 20, 2007 8:58 AM Sharique said: How I can disable right click on perticular element or div using jQuery. --- Sharique I don't know but let me be the first to ask, why? If you're trying to protect your content (images or viewing source) you're wasting your time since it's trivial to circumvent a disabled clicker. If your reason is different than that I'd be interested in hearing it. :) Chris.
[jQuery] Re: Superfish, Tabs and IE z-index
Joel Birch wrote: On 21/04/2007, at 12:43 AM, Chris Scott wrote: I'm using Superfish for my menus and the Tabs plugin. By default, the Superfish menus show up behind the tabs. The Tabs css uses a z-index of 2 so I set the Superfish css to use a z-index of 3. This works in FF and the menus show up in front of the tabs. However, IE doesn't play nice and the menus show behind the tabs. Has anyone come across this and have a fix? I'm using the bgiframe option in Superfish for the menus if that matters. I don't have the code posted right now since this is on a private system but I can work up a demo page if it would help. Thanks. -- Chris Scott Hi Chris. I'd love to help you out. It's 1.30am here but I'll have a look at your problem tomorrow or ASAP if no-one else has solved it by then. If you could create a demo page that would definitely help resolve this easier and quicker. Joel Birch. Thanks Joel. Here's a demo page: http://iamzed.com/jquery/superfishtabs.html I put the info. on what I customized from the default superfish.css on there. -- Chris Scott Adaptive Hosting Solutions, Inc. | Blogzerk - blog hosting http://www.adaptivehostingsolutions.com/ | http://www.blogzerk.com/
[jQuery] Re: find.click vs bind(click)
OK, going back to this function: *$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); }); If it's a case where the item 'edit' doesn't exist on the loaded page, it would cause an error, correct? If so, how do I first check if it exists, then only do the binding if it exists? On 4/17/07 10:12 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: be aware that sometimes when a javascript error occurs in front of the return false, it will cause the link to activate. are you using firebug? if so, find the one catch(e) in the jquery.js file that is worth setting a breakpoint at and see if the script stops there. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, April 17, 2007 11:26:16 AM Subject: [jQuery] Re: find.click vs bind(click) Unfortunately this is an internal application. The jQuery code on the page is just this (I have the one function commented out b/c I couldn't get that to work): var $j = jQuery.noConflict(); function setStatus(statname, statID, stattitle){ if (statID != '') var method = 'remove'; else var method = 'add'; $j.post('/admin/includes/tools/runtime.lasso' + subargs, { catalog: 'hirestatus', method: method, statusID: statID, hrstatus: stattitle, statname: statname, statusDate: myDate }); return false; } modify = function(){ $j(#changedmessage).text(Click Update to save changes); document.jobinfo.method.value=Update; document.jobinfo.method.disabled=false; } /*$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); });*/ function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } The link I'm trying to load is on a page like this: a href=/job.lasso?page=jobcid=6a3b9887af24e894section=sl_injobpage=descrip tview=edit id=edit onclick=loadEdit(); return false;img src=/images/edit.gif border=0 height=17 width=10/a On 4/17/07 11:04 AM, John Resig [EMAIL PROTECTED] wrote: Do you have an example with a full page, there's probably another issue here. --John On 4/17/07, Shelane Enos [EMAIL PROTECTED] wrote: I changed to this: function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } And added the function itself to my link. onclick=loadEdit(); The return false in the function isn't working. If I put it in the onclick (onclick=loadEdit(); return false;) then the page is loaded properly. Otherwise the function (even with the return false in the function) is allowing link to be followed anyway. On 4/17/07 10:22 AM, Shelane Enos [EMAIL PROTECTED] wrote: So I'm trying this: $j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } bindEdit(); }); Which to me says bind an onclick function to an a tag with ID 'edit'. Read the value of it's href (pages are dynamically loaded an hrefs change). Load the link into the div id jobinfo and now call bindEdit to bind the click event to the edit link on the newly loaded page. Return false so it doesn't follow the link as a normal link. OK, so it doesn't work. The page loads normally instead of into the div via ajax and I get too much recursion errors in the console. Am I doing something wrong here? On 4/17/07 9:57 AM, spinnach [EMAIL PROTECTED] wrote: .bind('click') is faster because you bind it directly to the element, .find() must first find the element inside the #jobinfo element and then bind the appropriate event.. there is no difference between .bind('click') and .click(), .click is just an alias for .bind('click').. and if i'm not mistaken, .click was taken out of the core since 1.1 (i may be wrong, i know some aliases were removed, but not sure which - so i just use .bind for everything :)).. dennis. Shelane Enos wrote: What is the difference, advantage/disadvantage of these different methods: bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } bindEdit = function(){
[jQuery] Re: Treeview persistence (cookies) and a dynamic (PHP/MySQL built) UL - not holding state
withinreach schrieb: I'm working with Treeview, latest version, needing the cookie/ persistence feature for a project. Sample demo works fine on my local machine (I can click on 2nd tree, change what's open/closed, browse to another page, then return (BACK button), and the tree holds its state. Great! Can't get it to work in my test system though. http://www.wrctest.com/tt2006/tennis_lessons_showall.php Hi Mike, please change: $(#lessons).Treeview({ speed: fast, collapsed: true, unique: true, store: true, }); $(#lessons).Treeview({ control: #treecontrol }); to: $(#lessons).Treeview({ speed: fast, collapsed: true, unique: true, store: true, control: #treecontrol }); Maybe that even fixes your problem. :) Cheers, /rw
[jQuery] Re: What is wrong with this code
jQuery(item_content).filter(#contentpane .contentpane p, :first); Filter removes those items from your search. Perhaps you want to use find instead. Try the following code: jQuery.get(item_link,function(item_content){ var new_content =jQuery(#contentpane .contentpane p,item_content).html(); jQuery(#myContent).html(new_content).slideDown(slow); }); ~Sean
[jQuery] Re: Google AJAX Feed API
In very basic terms you can pretty much substitute the word join or combine for mash-up. Thus, in this case we're combining RSS feeds from multiple sources into a single presentation. ~ ~ Dave On Fri, 20 Apr 2007 11:25:54 -0500, Christopher Jordan [EMAIL PROTECTED] wrote: So by mashing you mean supplying multiple feeds from different domains? Maybe I should just google mashing feeds or feed mashing defined or something. Chris Mike Alsup wrote: Hi Chris, Typically you need a server-side component to pull off a mashup because you're combining content from multiple sources. JavaScript employs a same origin policy to prevent XHR requests to foreign domains so you need to do your mashing on the server. But with this new Google API you can mash feed urls on the client because they're providing the server-side logic for you. Thanks, Google! Mike Can you explain what you mean by mashing feeds on the client? I'm not really well versed in RSS feeds (which is what I'm assuming you mean by feeds) so I'm interested in what this means.
[jQuery] Re: Is there an image cropping plugin?
I don't think there is a crop plugin, but there is an ImagePan (http://motherrussia.polyester.se/jquery/panview/) plugin that you might find usefull. ~Sean
[jQuery] Re: Google AJAX Feed API
Hi Bruce, Make sure the path to jquery and the file name are correct. I can't post a demo from behind my firewall but I can put something online later. Mike I have the api key, it is indeed sharp. Did some yesterday with it.The code below looks interesting, but when I do it I get a blank page. Have the latest jquery1.1.2.js and key, page remains blank? Any demo of this to see whats wrong
[jQuery] Re: Best way to determine if a user has Javascript enabled?
-Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim
[jQuery] Re: Using EXT with Jquery
That was actually a bug in my page - I was quick to pull the example together and plain forgot to test outside of Firefox. I've fixed it now (it was a trailing comma in the last element in an object) and should work in all the browsers. On Apr 20, 2:42 pm, Andy Matthews [EMAIL PROTECTED] wrote: What is that page supposed to do? I get a js error in both IE 6 and 7. All I see is two paragraphs of Lorem Ipsum. -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Eli Sent: Friday, April 20, 2007 8:37 AM To: jQuery (English) Subject: [jQuery] Re: Using EXT with Jquery Thanks all of you, especially Remy, I managed to solve my problem, thishttp://remysharp.com/wp-content/uploads/2007/04/ext_layout.html helped me a lot mate, thanks :) On Apr 20, 2:06 pm, Remy Sharp [EMAIL PROTECTED] wrote: I also wrote up a short article on my initial play with Ext and the mistakes I made (it also includes a link the jquery-plugins.js file that Juha points out is missing): http://remysharp.com/2007/04/20/jquery-ext/
[jQuery] jQ Site
Not sure where we're supposed to submit jQ sites, but here's http://www.e-texteditor.com/ -- looks like a cool text editor too. ~ ~ Dave
[jQuery] Re: Google AJAX Feed API
Mike, Understood thanks for answering. Paths tripple checked Your way of writing it looks interesting, didn't know you could specify a feed like that. Google uses: executeList : Google News,Digg, Technorati,Google, Yahoo] etc Maybe something is lost in code by email dunno: http://www.bkdesign.ca/1jqrss.html Bruce P - Original Message - From: Mike Alsup [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 12:51 PM Subject: [jQuery] Re: Google AJAX Feed API Hi Bruce, Make sure the path to jquery and the file name are correct. I can't post a demo from behind my firewall but I can put something online later. Mike I have the api key, it is indeed sharp. Did some yesterday with it.The code below looks interesting, but when I do it I get a blank page. Have the latest jquery1.1.2.js and key, page remains blank? Any demo of this to see whats wrong
[jQuery] Finding id of this
I apologize if this solution is posted, but I searched and trying to get through hundreds of results is a bit painful. So I have these titles: Create Reminder, Create Hold Status, Change State. I want to bind a click event to all of them which will toggle the show/hide attribute of a corresponding div. So I have this: $(function(){ $(this).find('a.reminder').click(function(){ $(this).toggle(); $(this).blur(); return false; });//end click }); However, in this function I'm toggling the title link itself, which is NOT what I want. I want to toggle the corresponding div. so, the titles look like this in html: a href=# class=reminder id=areminderCreate Reminder/a I would like to use the id (areminder) in this case to now toggle the div div_areminder. How do I find the id of each of these a tags to apply toggle like this: find id method $('#div_' + idofatag).toggle(); ?? That's my question. That you very much. Have a nice day.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
In the meantime, I suppose you could use JavaScript to append a variable to the URL, and then have your CF decide what to send based on the presence of that variable. Example: html script type=text/javascript $(function() { var $exampleForm = $(#exampleForm); var oldAction = $exampleForm.attr(action); $exampleForm.attr(action, oldAction + ?isAjax=true); }); /script form id=exampleForm action=example.cfm !-- Form fields go here -- /form /html For the form is initially hidden thing, you could use JavaScript to hide the form in a $(document).ready() function. That way people without JS see the form, and people with JS see what you originally wanted them to. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Drupal and JQuery
Merc, You might want to look at the work being done on what's called the AHAH framework for Drupal. The guy working on that is doing a lot of thinking about how to correctly integrate jQuery and Drupal's FormAPI in a clean, safe, degradable fashion. The widget you describe is essentially a Drupal form or part of one. Scott On 4/18/07, merc [EMAIL PROTECTED] wrote: Hello everybody, I am in the middle of developing a karma module for Drupal (amazingly, it doesn't have one already and we need one for Free Software Magazine). While I know Drupa quite well, I know nothing about Javascript and JQuery. I am finding things a little difficult, to be honest. I know how Ajax works, but I am a little lost. Basically, I need to display a small voting SELECT for each published comment (-3 to +3). A logged in user should be able to pick a number - the second s/he changes the selected number (0 by default), the browser should send the query to the server (with node id and vote). The server should register the vote. The page at that point should display the registered node where the SELECT was - or a short error message. Believe it or not, I tried to do this and failed miserably. I am looking for somebody out there who would be willing to give me a hand with the JQuery side of the module. I looked at: http://docs.jquery.com/Ajax But I just haven't understood what I should do exactly. Now... I was wondering if there were a good soul out there willing to help me with this. All of the code will be released under the GPL. I am happy to pay $100, to say thank you. Please get in touch with me if you want to lend us a hand - [EMAIL PROTECTED] Thanks a lot for your help! Merc. -- View this message in context: http://www.nabble.com/Drupal-and-JQuery-tf3601206s15494.html#a10059393 Sent from the JQuery mailing list archive at Nabble.com. -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Finding id of this
Nevermind. I answered my own question. Duh, I've used .attr before. Here are my changes which work beautifully. Thanks again jQuery for easy unobtrusive js. New function: $(function(){ $(this).find('a.reminder').click(function(){ var myid = $(this).attr('id'); $('#div_' + myid).toggle(); $(this).blur(); return false; }); }); On Apr 20, 10:21 am, Shelane Enos [EMAIL PROTECTED] wrote: I apologize if this solution is posted, but I searched and trying to get through hundreds of results is a bit painful. So I have these titles: Create Reminder, Create Hold Status, Change State. I want to bind a click event to all of them which will toggle the show/hide attribute of a corresponding div. So I have this: $(function(){ $(this).find('a.reminder').click(function(){ $(this).toggle(); $(this).blur(); return false; });//end click }); However, in this function I'm toggling the title link itself, which is NOT what I want. I want to toggle the corresponding div. so, the titles look like this in html: a href=# class=reminder id=areminderCreate Reminder/a I would like to use the id (areminder) in this case to now toggle the div div_areminder. How do I find the id of each of these a tags to apply toggle like this: find id method $('#div_' + idofatag).toggle(); ?? That's my question. That you very much. Have a nice day.
[jQuery] Re: Finding id of this
Hi Shelane, I think this should work... $(function(){ $('a.reminder').click(function(){ var divId = '#div_' + $(this).attr('id'); $(divId).toggle(); $(this).blur(); return false; });//end click }); Let me know if it doesn't produce the results you're looking for. Cheers, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 20, 2007, at 1:21 PM, Shelane Enos wrote: I apologize if this solution is posted, but I searched and trying to get through hundreds of results is a bit painful. So I have these titles: Create Reminder, Create Hold Status, Change State. I want to bind a click event to all of them which will toggle the show/hide attribute of a corresponding div. So I have this: $(function(){ $(this).find('a.reminder').click(function(){ $(this).toggle(); $(this).blur(); return false; });//end click }); However, in this function I'm toggling the title link itself, which is NOT what I want. I want to toggle the corresponding div. so, the titles look like this in html: a href=# class=reminder id=areminderCreate Reminder/a I would like to use the id (areminder) in this case to now toggle the div div_areminder. How do I find the id of each of these a tags to apply toggle like this: find id method $('#div_' + idofatag).toggle(); ?? That's my question. That you very much. Have a nice day.
[jQuery] Re: Finding id of this
You can use the jQuery method attr() to get the id attribute of the element. $(this).attr('id'); However, since 'this' is the element and there is a DOM property exposing the id you can get the id from the a tag like this. this.id; So with that knowledge here is how the click hander would look. $(function(){ $(this).find('a.reminder').click(function(){ $('#div_' + this.id).toggle(); this.blur() return false; });//end click }); I also just used the DOM method blur instead of the jQuery blur() method (which actually just calls the DOM method blur()). Since you have the DOM element and not doing anything else with it, it makes more sense to just use the DOM method. Saving on typing too. :) You can also write your selector like this: $('a.reminder', this).click(function() { The second parameter is the scope in which jQuery should run the selector. -- Brandon Aaron On 4/20/07, Shelane Enos [EMAIL PROTECTED] wrote: I apologize if this solution is posted, but I searched and trying to get through hundreds of results is a bit painful. So I have these titles: Create Reminder, Create Hold Status, Change State. I want to bind a click event to all of them which will toggle the show/hide attribute of a corresponding div. So I have this: $(function(){ $(this).find('a.reminder').click(function(){ $(this).toggle(); $(this).blur(); return false; });//end click }); However, in this function I'm toggling the title link itself, which is NOT what I want. I want to toggle the corresponding div. so, the titles look like this in html: a href=# class=reminder id=areminderCreate Reminder/a I would like to use the id (areminder) in this case to now toggle the div div_areminder. How do I find the id of each of these a tags to apply toggle like this: find id method $('#div_' + idofatag).toggle(); ?? That's my question. That you very much. Have a nice day.
[jQuery] Re: Google AJAX Feed API
I have the api key, it is indeed sharp. Did some yesterday with it.The code below looks interesting, but when I do it I get a blank page. Have the latest jquery1.1.2.js and key, page remains blank? Any demo of this to see whats wrong Bruce P - Original Message - From: Mike Alsup [EMAIL PROTECTED] To: jQuery Discussion jquery-en@googlegroups.com Sent: Friday, April 20, 2007 10:21 AM Subject: [jQuery] Google AJAX Feed API In case anyone missed it, Google recently released an API for mashing feeds on the client. http://googleajaxsearchapi.blogspot.com/2007/04/announcing-google-ajax-feed-api.html It's really quite cool (and fast). Below is a short demo of how it works. To try it, replace [your key] with your Google API key. Mike html head style type=text/css body { font-family: 'trebuchet ms'; color: #555; font-size: small; } div.feed { margin: 20px; padding: 20px; border: 1px dashed #ddd; background: #ffd } div.date { font-size: smaller; color: #aaa } h1.blog { font-size: large; padding: 5px; margin: 2px 0; text-align: center } h2.feed { font-size: medium; padding: 0; margin: 2px 0 } /style script type=text/javascript src=../rel/jquery-1.1.2.js/script script type=text/javascript src=http://www.google.com/jsapi?key=[your key]/script script type=text/javascript google.load(feeds, 1); google.setOnLoadCallback(function() { var sites = [ 'http://jquery.com/blog/feed/', 'http://feeds.feedburner.com/JohnResig', 'http://bassistance.de/feed/', 'http://www.stilbuero.de/feed/atom/', 'http://www.learningjquery.com/feed/', 'http://www.reybango.com/rss.cfm', 'http://feeds.feedburner.com/WebDeveloperBlog' ]; jQuery.each(sites, function(j,site) { var feed = new google.feeds.Feed(site); feed.load(function(result) { if (!result.error) { var max = Math.min(result.feed.entries.length, 5); // 5 at most var f = $('div class=feed/div').appendTo('body'); f.append('h1 class=blog'+result.feed.title+'/h1'); for (var i = 0; i max; i++) { var entry = result.feed.entries[i]; var title = entry.title; var snip = entry.contentSnippet; var link = entry.link; var date = entry.publishedDate; f.append('h2 class=feeda href='+link+''+title+'/a/h2') .append('div class=date'+date+'/div') .append('div class=snip'+snip+'/div '); } } }); }); }); /script /head body/body /html
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Looks good.. let's make sure I understand. So if JS is enabled, the script will run, appending ?isAjax=true to whatever page is specified if my form's action page. correct? Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 1:22 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? In the meantime, I suppose you could use JavaScript to append a variable to the URL, and then have your CF decide what to send based on the presence of that variable. Example: html script type=text/javascript $(function() { var $exampleForm = $(#exampleForm); var oldAction = $exampleForm.attr(action); $exampleForm.attr(action, oldAction + ?isAjax=true); }); /script form id=exampleForm action=example.cfm !-- Form fields go here -- /form /html For the form is initially hidden thing, you could use JavaScript to hide the form in a $(document).ready() function. That way people without JS see the form, and people with JS see what you originally wanted them to. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Waiting for CF 8... -Original Message- From: jquery-en@googlegroups.com [mailto:jquery-en@googlegroups.com mailto:jquery-en@googlegroups.com ] On Behalf Of Priest, James (NIH/NIEHS) [C] Sent: Friday, April 20, 2007 12:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 12:00 PM (Hopefully it's compatible with CF 4.5!) Unfortunately it looks like it was introduced in v5: http://www.actcfug.com/files/cfmlhistory/functions/gethttprequestdata.ht m You need to put down the Ajax and upgrade your CF :) Jim -- Aaron Heimlich Web Developer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Retrieving information outside of $this
Ooops... This gets the latitude value: var lat = $(this).parent().parent().children('.editable').children('span').attr('name' ,'longitude').html(); Change it up to get longitude -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of SiCo Sent: Friday, April 20, 2007 12:55 PM To: jQuery (English) Subject: [jQuery] Retrieving information outside of $this I have a small problem, probably more to do with me not knowing more than anything else!! My structure is like so: div class=main loc rel=album name=17 h3Los Angeles/h3 div class=data div class=editable name=17bLatitude:/b span name=latitude34.052019404448785/spanbr / bLongitude:/b span name=longitude-118.24318885803223/span /div p img src=trip-goto.gif name=goto rel= width=16 height=16 border=0 alt=View this location on the map. title=View this location on the map. / a href=img src=trip-remove.gif width=16 height=16 border=0 alt=Remove this album from the trip. title=Remove this album from the trip. //a /p /div /div Clicking on each of these blocks (multiple blocks per list) changes it to an editor and you can select on aGoogle Map the location and it updates etc. Now what I want is when the trip-goto.gif img is clicked I want the map to scroll to the lat and long held in the span. What I can't work out is in the click event how to grab the lat and long from the span tags... either traversing the tree backwards etc or another way. I can't / don't want to use id's as there can be 20 of these per page in ahierachical fashion so I'd rather work with '$this'... Any thoguhts? I am sur eit's easy... Thanks Simon
[jQuery] Re: What is wrong with this code
Thats what I am trying to do, filter our everything other then the first paragraph from the results I get through jQuery.get... I tried your code Sean but it too did not help. I am just wondering now what is the code if I want to select/extract first paragraph from the ajax get function and inject it into some div. I guess it should be something that many people would have done in their aplications but I am not able to find the way to do it. Please don't abandon this thread guys. I need more help. thanks On Apr 20, 12:38 pm, Sean Catchpole [EMAIL PROTECTED] wrote: jQuery(item_content).filter(#contentpane .contentpane p, :first); Filter removes those items from your search. Perhaps you want to use find instead. Try the following code: jQuery.get(item_link,function(item_content){ var new_content =jQuery(#contentpane .contentpane p,item_content).html(); jQuery(#myContent).html(new_content).slideDown(slow); }); ~Sean
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Didn't read the entire thread but appending parameters like this to an url just doesn't seem right to me. Maybe your problem can be solved by looking if the client sent a X-Requested-With == 'XMLHttpRequest' header. That's how we in CakePHP find out if a page was requested via Ajax or not ; ). Note: This is nothing the XMLHttpRequest adds itself, but I know jQuery and also Prototype do it for all their ajax requests for you. -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de
[jQuery] Re: Retrieving information outside of $this
Sorry for the loads of emails. Using your exact code setup, this is what I came up with: $('div.data a').click( function() { var lat = $(this).parent().parent().children('.editable').children('span').attr('name' ,'longitude').html(); alert(lat); return false; }); -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of SiCo Sent: Friday, April 20, 2007 12:55 PM To: jQuery (English) Subject: [jQuery] Retrieving information outside of $this I have a small problem, probably more to do with me not knowing more than anything else!! My structure is like so: div class=main loc rel=album name=17 h3Los Angeles/h3 div class=data div class=editable name=17bLatitude:/b span name=latitude34.052019404448785/spanbr / bLongitude:/b span name=longitude-118.24318885803223/span /div p img src=trip-goto.gif name=goto rel= width=16 height=16 border=0 alt=View this location on the map. title=View this location on the map. / a href=img src=trip-remove.gif width=16 height=16 border=0 alt=Remove this album from the trip. title=Remove this album from the trip. //a /p /div /div Clicking on each of these blocks (multiple blocks per list) changes it to an editor and you can select on aGoogle Map the location and it updates etc. Now what I want is when the trip-goto.gif img is clicked I want the map to scroll to the lat and long held in the span. What I can't work out is in the click event how to grab the lat and long from the span tags... either traversing the tree backwards etc or another way. I can't / don't want to use id's as there can be 20 of these per page in ahierachical fashion so I'd rather work with '$this'... Any thoguhts? I am sur eit's easy... Thanks Simon
[jQuery] Who's Using jQuery
Don't suppose this counts, but an example for using the new Digg API features jQuery: http://apidoc.digg.com/ToolkitsServicesDigg#ExamplejQuerycode - jake
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Felix Geisendörfer [EMAIL PROTECTED] wrote: Didn't read the entire thread but appending parameters like this to an url just doesn't seem right to me. I would normally agree, but Rick is using ColdFusion 4.5, which apparently isn't capable of inspecting HTTP Headers. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Google AJAX Feed API
Thanks Dave. I appreciate the initiation. :o) Chris DaveG wrote: In very basic terms you can pretty much substitute the word join or combine for mash-up. Thus, in this case we're combining RSS feeds from multiple sources into a single presentation. ~ ~ Dave On Fri, 20 Apr 2007 11:25:54 -0500, Christopher Jordan [EMAIL PROTECTED] wrote: So by mashing you mean supplying multiple feeds from different domains? Maybe I should just google mashing feeds or feed mashing defined or something. Chris Mike Alsup wrote: Hi Chris, Typically you need a server-side component to pull off a mashup because you're combining content from multiple sources. JavaScript employs a same origin policy to prevent XHR requests to foreign domains so you need to do your mashing on the server. But with this new Google API you can mash feed urls on the client because they're providing the server-side logic for you. Thanks, Google! Mike Can you explain what you mean by mashing feeds on the client? I'm not really well versed in RSS feeds (which is what I'm assuming you mean by feeds) so I'm interested in what this means. -- http://www.cjordan.us
[jQuery] Re: Google AJAX Feed API
Well, not to me lol. Nice work! Is there a way to get it to say: Published 5 minutes ago? Bruce - Original Message - From: Mike Alsup [EMAIL PROTECTED] It's actually quite similar to the example posted here: http://code.google.com/apis/ajaxfeeds/documentation/ My code just uses jQuery instead of DOM code to create the page. Mike Nice work, will play with this a while as its quite different than Google's examples.
[jQuery] Re: Google AJAX Feed API
Is there a way to get it to say: Published 5 minutes ago? Well, you have the pub date so from that you can calculate whatever you want to display. What would one add to this to get it to update in real time? You can reload the feeds as often as you want but ultimately you're at the mercy of Google's FeedFetcher cache. For details: http://code.google.com/apis/ajaxfeeds/documentation/#Caching Mike
[jQuery] Re: ajax Error
Hi Simon, I'd recommend using http://jquery.com/api/ and firebug to help you debug. You're function looks ok, but I think error is an object that contains lots of data. Check out $.ajaxError at the api I linked. Let me know if you have more questions. ~Sean
[jQuery] Re: What is wrong with this code
Can you post some sample html that you're working with? It's a little hard to work blind. Filter would remove your search from the results, find would leave on your search in the results. apples oranges bananas filter oranges would leave: apples and bananas find oranges would leave: oranges I hope that helps. ~Sean
[jQuery] Re: What is wrong with this code
You're absolutely right. I think at some point in jQuery's past this was flipped, but I'm glad to know that the filter functions works as intended now. Sorry for the confusion. =( ~Sean
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Retrieving information outside of $this
Andy Matthews schrieb: What?!?!? You can use html based pathing in jQuery? Why didn't someone tell me that?!? How come I get an error? Sure I can! ;P What kind of error?
[jQuery] Re: Google AJAX Feed API
To view the api example, you can open the file from the browser (no need to have a API key and put it on a server). Also, If someone has the time, a cool plugin idea is an RSS viewer. Here's a quick and dirty plugin to convert anchors into feed divs. Modify it to suit your needs: (function($) { $.fn.toFeed = function(options) { return this.each(function() { var opts = jQuery.extend({ url: this.href, max: 5 }, options || {}); var $this = $(this); var feed = new google.feeds.Feed(opts.url); feed.load(function(result) { if (!result.error) { var max = Math.min(result.feed.entries.length, opts.max); var f = $('div class=feed/div'); f.append('h1 class=feed'+result.feed.title+'/h1'); for (var i = 0; i max; i++) { var entry = result.feed.entries[i]; var title = entry.title; var snip = entry.contentSnippet; var link = entry.link; var date = entry.publishedDate; f.append('h2 class=feeditema href='+link+''+title+'/a/h2') .append('div class=feeddate'+date+'/div') .append('div class=feedsnip'+snip+'/div '); } $this.after(f).remove(); } }); }); }; })(jQuery); Here's a page that uses the above plugin: htmlhead style type=text/css #main { width: 300px } body { font-family: 'trebuchet ms'; color: #555; font-size: small; } div.feed { margin: 20px; padding: 20px; border: 1px dashed #ddd; background: #ffd } div.feeddate { font-size: smaller; color: #aaa } h1.feed { font-size: large; padding: 5px; margin: 2px 0; text-align: center } h2.feeditem { font-size: medium; padding: 0; margin: 2px 0 } /style script type=text/javascript src=../rel/jquery-1.1.2.js/script script type=text/javascript src=feed-from-above.js/script script type=text/javascript src=http://www.google.com/jsapi?key=[your key]/script script type=text/javascript google.load(feeds, 1); $(function() { $('a.feed').toFeed(); }); /script /head bodydiv id=main a class=feed href=http://jquery.com/blog/feed/;jQuery/a a class=feed href=http://feeds.feedburner.com/JohnResig;Resig/a a class=feed href=http://www.learningjquery.com/feed/;Learning jQuery/a /div/body /html
[jQuery] Re: find.click vs bind(click)
no it should not throw an error. j(#edit) will return an empty array is all and the bind will not be called. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 9:10:58 AM Subject: [jQuery] Re: find.click vs bind(click) OK, going back to this function: *$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); }); If it's a case where the item 'edit' doesn't exist on the loaded page, it would cause an error, correct? If so, how do I first check if it exists, then only do the binding if it exists? On 4/17/07 10:12 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: be aware that sometimes when a javascript error occurs in front of the return false, it will cause the link to activate. are you using firebug? if so, find the one catch(e) in the jquery.js file that is worth setting a breakpoint at and see if the script stops there. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, April 17, 2007 11:26:16 AM Subject: [jQuery] Re: find.click vs bind(click) Unfortunately this is an internal application. The jQuery code on the page is just this (I have the one function commented out b/c I couldn't get that to work): var $j = jQuery.noConflict(); function setStatus(statname, statID, stattitle){ if (statID != '') var method = 'remove'; else var method = 'add'; $j.post('/admin/includes/tools/runtime.lasso' + subargs, { catalog: 'hirestatus', method: method, statusID: statID, hrstatus: stattitle, statname: statname, statusDate: myDate }); return false; } modify = function(){ $j(#changedmessage).text(Click Update to save changes); document.jobinfo.method.value=Update; document.jobinfo.method.disabled=false; } /*$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); });*/ function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } The link I'm trying to load is on a page like this: a href=/job.lasso?page=jobcid=6a3b9887af24e894section=sl_injobpage=descrip tview=edit id=edit onclick=loadEdit(); return false;img src=/images/edit.gif border=0 height=17 width=10/a On 4/17/07 11:04 AM, John Resig [EMAIL PROTECTED] wrote: Do you have an example with a full page, there's probably another issue here. --John On 4/17/07, Shelane Enos [EMAIL PROTECTED] wrote: I changed to this: function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } And added the function itself to my link. onclick=loadEdit(); The return false in the function isn't working. If I put it in the onclick (onclick=loadEdit(); return false;) then the page is loaded properly. Otherwise the function (even with the return false in the function) is allowing link to be followed anyway. On 4/17/07 10:22 AM, Shelane Enos [EMAIL PROTECTED] wrote: So I'm trying this: $j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } bindEdit(); }); Which to me says bind an onclick function to an a tag with ID 'edit'. Read the value of it's href (pages are dynamically loaded an hrefs change). Load the link into the div id jobinfo and now call bindEdit to bind the click event to the edit link on the newly loaded page. Return false so it doesn't follow the link as a normal link. OK, so it doesn't work. The page loads normally instead of into the div via ajax and I get too much recursion errors in the console. Am I doing something wrong here? On 4/17/07 9:57 AM, spinnach [EMAIL PROTECTED] wrote: .bind('click') is faster because you bind it directly to the element, .find() must first find the element inside the #jobinfo element and then bind the appropriate event.. there is no difference between .bind('click') and .click(), .click is just an alias for .bind('click').. and if i'm not mistaken, .click was taken out of the core since 1.1 (i may be wrong, i know some aliases were removed, but not sure which - so i just use .bind for everything :)).. dennis. Shelane Enos wrote: What is the difference, advantage/disadvantage of these different
[jQuery] Re: Retrieving information outside of $this
Ah...i see it. It was a syntax error. You had the closing }) after the second alert and I missed it. Works a treat. Freaking awesome! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Roman Weich Sent: Friday, April 20, 2007 2:52 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Retrieving information outside of $this Andy Matthews schrieb: What?!?!? You can use html based pathing in jQuery? Why didn't someone tell me that?!? How come I get an error? Sure I can! ;P What kind of error?
[jQuery] Re: find.click vs bind(click)
Thanks to another problem I had, I've changed my code to this (which fixed my issue): bindEdit = function(){ var linkval = $j('#edit').attr(href); if (linkval != ''){ $j('#edit').click(function(){ $j('#jobinfodisplay').load(linkval); return false; }); } }; But you're saying that I should be able to do this: bindEdit = function(){ $j('#edit').click(function(){ var linkval = $j('#edit').attr(href); $j('#jobinfodisplay').load(linkval); return false; }); }; On 4/20/07 1:00 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: no it should not throw an error. j(#edit) will return an empty array is all and the bind will not be called. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 9:10:58 AM Subject: [jQuery] Re: find.click vs bind(click) OK, going back to this function: *$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); }); If it's a case where the item 'edit' doesn't exist on the loaded page, it would cause an error, correct? If so, how do I first check if it exists, then only do the binding if it exists? On 4/17/07 10:12 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: be aware that sometimes when a javascript error occurs in front of the return false, it will cause the link to activate. are you using firebug? if so, find the one catch(e) in the jquery.js file that is worth setting a breakpoint at and see if the script stops there. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, April 17, 2007 11:26:16 AM Subject: [jQuery] Re: find.click vs bind(click) Unfortunately this is an internal application. The jQuery code on the page is just this (I have the one function commented out b/c I couldn't get that to work): var $j = jQuery.noConflict(); function setStatus(statname, statID, stattitle){ if (statID != '') var method = 'remove'; else var method = 'add'; $j.post('/admin/includes/tools/runtime.lasso' + subargs, { catalog: 'hirestatus', method: method, statusID: statID, hrstatus: stattitle, statname: statname, statusDate: myDate }); return false; } modify = function(){ $j(#changedmessage).text(Click Update to save changes); document.jobinfo.method.value=Update; document.jobinfo.method.disabled=false; } /*$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); });*/ function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } The link I'm trying to load is on a page like this: a href=/job.lasso?page=jobcid=6a3b9887af24e894section=sl_injobpage=descrip tview=edit id=edit onclick=loadEdit(); return false;img src=/images/edit.gif border=0 height=17 width=10/a On 4/17/07 11:04 AM, John Resig [EMAIL PROTECTED] wrote: Do you have an example with a full page, there's probably another issue here. --John On 4/17/07, Shelane Enos [EMAIL PROTECTED] wrote: I changed to this: function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } And added the function itself to my link. onclick=loadEdit(); The return false in the function isn't working. If I put it in the onclick (onclick=loadEdit(); return false;) then the page is loaded properly. Otherwise the function (even with the return false in the function) is allowing link to be followed anyway. On 4/17/07 10:22 AM, Shelane Enos [EMAIL PROTECTED] wrote: So I'm trying this: $j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } bindEdit(); }); Which to me says bind an onclick function to an a tag with ID 'edit'. Read the value of it's href (pages are dynamically loaded an hrefs change). Load the link into the div id jobinfo and now call bindEdit to bind the click event to the edit link on the newly loaded page. Return false so it doesn't follow the link as a normal link. OK, so it doesn't work. The page loads normally instead of into the div via
[jQuery] Re: Best way to determine if a user has Javascript enabled?
That was the problem. now I'm getting the Query String. Now I've got see if I can make all of this work. Thanks! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 3:37 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: disabling right click
since you've already been condemned by some of the better minds on the list, I won't go there. BUT, you can try to bind the right click to do something special, there are 2 events of interest click with (e.button1 or e.which1)and contextmenu. Nothing is guaranteed to work, but try it for yourself. On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: Why not just answer his question instead of questioning the appropriateness of the action? If you must question his intent, at least answer the question and then point out any fallibilities... Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jake McGraw Sent: Friday, April 20, 2007 12:07 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: disabling right click Why would you want to do this? If you're attempting to prevent users from saving images or viewing your source, there are plenty of ways for them to circumvent disabling right click. See: http://www.sitepoint.com/article/dont-disable-right-click - jake On 4/20/07, Sharique [EMAIL PROTECTED] wrote: How I can disable right click on perticular element or div using jQuery. --- Sharique -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
[jQuery] Re: Google AJAX Feed API
Here is a really cool RSS viewer written with jQuery: http://www.osxcode.com/feedsearch/ --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 20, 2007, at 3:07 PM, Jose wrote: Hi, This is a very cool use for JQuery! To view the api example, you can open the file from the browser (no need to have a API key and put it on a server). Also, If someone has the time, a cool plugin idea is an RSS viewer. See http://web20.originalsignal.com/ for a great RSS viewer written with prototype regards On 4/20/07, BKDesign Solutions [EMAIL PROTECTED] wrote: What would one add to this to get it to update in real time? That would be super cool! bruce P - Original Message - From: Mike Alsup [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 2:42 PM Subject: [jQuery] Re: Google AJAX Feed API It's actually quite similar to the example posted here: http://code.google.com/apis/ajaxfeeds/documentation/ My code just uses jQuery instead of DOM code to create the page. Mike Nice work, will play with this a while as its quite different than Google's examples.
[jQuery] Re: find.click vs bind(click)
not only am i saying that you should be able to do that, i am saying i think the second version is better. why? in version 1, you say var linkval = $j('#edit').attr(href); but the return value if #edit does not exist is not apparent. Will it be or will it be undefined? in version 2, you postpone getting that value until you are within the click handler, which will only get activated if #edit exists and is clicked. but, in version 2, it is simple: .click() will be called on each member of the array returned by j(#edit) which may be empty which is no biggy, like... for (var i=0; i 0; i++) { // never will happen; } - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 1:07:37 PM Subject: [jQuery] Re: find.click vs bind(click) Thanks to another problem I had, I've changed my code to this (which fixed my issue): bindEdit = function(){ var linkval = $j('#edit').attr(href); if (linkval != ''){ $j('#edit').click(function(){ $j('#jobinfodisplay').load(linkval); return false; }); } }; But you're saying that I should be able to do this: bindEdit = function(){ $j('#edit').click(function(){ var linkval = $j('#edit').attr(href); $j('#jobinfodisplay').load(linkval); return false; }); }; On 4/20/07 1:00 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: no it should not throw an error. j(#edit) will return an empty array is all and the bind will not be called. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 9:10:58 AM Subject: [jQuery] Re: find.click vs bind(click) OK, going back to this function: *$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); }); If it's a case where the item 'edit' doesn't exist on the loaded page, it would cause an error, correct? If so, how do I first check if it exists, then only do the binding if it exists? On 4/17/07 10:12 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: be aware that sometimes when a javascript error occurs in front of the return false, it will cause the link to activate. are you using firebug? if so, find the one catch(e) in the jquery.js file that is worth setting a breakpoint at and see if the script stops there. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, April 17, 2007 11:26:16 AM Subject: [jQuery] Re: find.click vs bind(click) Unfortunately this is an internal application. The jQuery code on the page is just this (I have the one function commented out b/c I couldn't get that to work): var $j = jQuery.noConflict(); function setStatus(statname, statID, stattitle){ if (statID != '') var method = 'remove'; else var method = 'add'; $j.post('/admin/includes/tools/runtime.lasso' + subargs, { catalog: 'hirestatus', method: method, statusID: statID, hrstatus: stattitle, statname: statname, statusDate: myDate }); return false; } modify = function(){ $j(#changedmessage).text(Click Update to save changes); document.jobinfo.method.value=Update; document.jobinfo.method.disabled=false; } /*$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); });*/ function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } The link I'm trying to load is on a page like this: a href=/job.lasso?page=jobcid=6a3b9887af24e894section=sl_injobpage=descrip tview=edit id=edit onclick=loadEdit(); return false;img src=/images/edit.gif border=0 height=17 width=10/a On 4/17/07 11:04 AM, John Resig [EMAIL PROTECTED] wrote: Do you have an example with a full page, there's probably another issue here. --John On 4/17/07, Shelane Enos [EMAIL PROTECTED] wrote: I changed to this: function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } And added the function itself to my link. onclick=loadEdit(); The return false in the function isn't working. If I put it in the onclick (onclick=loadEdit(); return false;) then the page is loaded properly. Otherwise the function (even with the return false in the function) is allowing link to be followed anyway.
[jQuery] Performance profiling (in IE in particular)
I posted a message some time ago on performance profiling and testing in IE and the best thing available was Firebug Lite which required me to wrap everything in start/end calls. I've since written a time library to hook functions to reduce the amount of work required to performance test. It works in IE6+, Opera, Firefox and Safari. http://remysharp.com/2007/04/20/performance-profiling-javascript/ In particular, you can attach this to any function, including the jQuery selector function: $ = time.func($); Now when you run $('table [EMAIL PROTECTED]user]') (or a query you think may be unoptimised) it will return the standard jQuery result and log the time taken to execute the selector. Or you can test the functions attached to events $('a').time('click') If anyone has any suggestions or spots and bugs or improvements that can be made, please drop me a comment. Thanks.
[jQuery] Re: find.click vs bind(click)
Working wonderfully. Thanks. On 4/20/07 1:25 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: not only am i saying that you should be able to do that, i am saying i think the second version is better. why? in version 1, you say var linkval = $j('#edit').attr(href); but the return value if #edit does not exist is not apparent. Will it be or will it be undefined? in version 2, you postpone getting that value until you are within the click handler, which will only get activated if #edit exists and is clicked. but, in version 2, it is simple: .click() will be called on each member of the array returned by j(#edit) which may be empty which is no biggy, like... for (var i=0; i 0; i++) { // never will happen; } - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 1:07:37 PM Subject: [jQuery] Re: find.click vs bind(click) Thanks to another problem I had, I've changed my code to this (which fixed my issue): bindEdit = function(){ var linkval = $j('#edit').attr(href); if (linkval != ''){ $j('#edit').click(function(){ $j('#jobinfodisplay').load(linkval); return false; }); } }; But you're saying that I should be able to do this: bindEdit = function(){ $j('#edit').click(function(){ var linkval = $j('#edit').attr(href); $j('#jobinfodisplay').load(linkval); return false; }); }; On 4/20/07 1:00 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: no it should not throw an error. j(#edit) will return an empty array is all and the bind will not be called. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 9:10:58 AM Subject: [jQuery] Re: find.click vs bind(click) OK, going back to this function: *$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); }); If it's a case where the item 'edit' doesn't exist on the loaded page, it would cause an error, correct? If so, how do I first check if it exists, then only do the binding if it exists? On 4/17/07 10:12 PM, Ariel Jakobovits [EMAIL PROTECTED] wrote: be aware that sometimes when a javascript error occurs in front of the return false, it will cause the link to activate. are you using firebug? if so, find the one catch(e) in the jquery.js file that is worth setting a breakpoint at and see if the script stops there. - Original Message From: Shelane Enos [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, April 17, 2007 11:26:16 AM Subject: [jQuery] Re: find.click vs bind(click) Unfortunately this is an internal application. The jQuery code on the page is just this (I have the one function commented out b/c I couldn't get that to work): var $j = jQuery.noConflict(); function setStatus(statname, statID, stattitle){ if (statID != '') var method = 'remove'; else var method = 'add'; $j.post('/admin/includes/tools/runtime.lasso' + subargs, { catalog: 'hirestatus', method: method, statusID: statID, hrstatus: stattitle, statname: statname, statusDate: myDate }); return false; } modify = function(){ $j(#changedmessage).text(Click Update to save changes); document.jobinfo.method.value=Update; document.jobinfo.method.disabled=false; } /*$j(function(){ bindEdit = function(){ $j('#edit').bind(click, function(){ var linkval = $j(this).attr(href); $j('#jobinfo').load(linkval, function(){ bindEdit(); }); return false; }); } //bindEdit(); });*/ function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } The link I'm trying to load is on a page like this: a href=/job.lasso?page=jobcid=6a3b9887af24e894section=sl_injobpage=descrip tview=edit id=edit onclick=loadEdit(); return false;img src=/images/edit.gif border=0 height=17 width=10/a On 4/17/07 11:04 AM, John Resig [EMAIL PROTECTED] wrote: Do you have an example with a full page, there's probably another issue here. --John On 4/17/07, Shelane Enos [EMAIL PROTECTED] wrote: I changed to this: function loadEdit(){ var linkval = $j('#edit').attr(href); $j('#jobinfo').load(linkval); return false; } And added the function itself to my link. onclick=loadEdit(); The return false in the function isn't working. If I put it in the onclick (onclick=loadEdit(); return
[jQuery] Re: Google AJAX Feed API
its so pretty - Original Message From: Karl Swedberg [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 1:21:18 PM Subject: [jQuery] Re: Google AJAX Feed API Here is a really cool RSS viewer written with jQuery: http://www.osxcode.com/feedsearch/ --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 20, 2007, at 3:07 PM, Jose wrote: Hi, This is a very cool use for JQuery! To view the api example, you can open the file from the browser (no need to have a API key and put it on a server). Also, If someone has the time, a cool plugin idea is an RSS viewer. See http://web20.originalsignal.com/ for a great RSS viewer written with prototype regards On 4/20/07, BKDesign Solutions [EMAIL PROTECTED] wrote: What would one add to this to get it to update in real time? That would be super cool! bruce P - Original Message - From: Mike Alsup [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Friday, April 20, 2007 2:42 PM Subject: [jQuery] Re: Google AJAX Feed API It's actually quite similar to the example posted here: http://code.google.com/apis/ajaxfeeds/documentation/ My code just uses jQuery instead of DOM code to create the page. Mike Nice work, will play with this a while as its quite different than Google's examples.
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Question: What typically causes the Firebug message The XML file does not appear to have any style information associated with it. The document tree is shown below. to display? I have hunted for this problem forever and can't see what's wrong. I'll provide code, but I just thought there might be something that's usually wrong when this pops up. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 4:09 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? That was the problem. now I'm getting the Query String. Now I've got see if I can make all of this work. Thanks! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 3:37 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: $(document).ready()(function { \n Should be: $(document).ready(function() { // stuff goes here... }); -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Treeview persistence (cookies) and a dynamic (PHP/MySQL built) UL - not holding state
A bit more digging, and now I've gotten it to work, but Works fine, if I use the unpacked version of treeview.js that is in the SVN. If I replace that with the packed version, stops working. additional 6K won't break the bank, but makes you worry about version control WITHIN the latest releases. *sigh*
[jQuery] Re: Best way to determine if a user has Javascript enabled?
On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Thanks for the feedback, Aaron. I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip. at least now I have some idea of what to look for! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 6:23 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Google AJAX Feed API
Excellent Mike. I've started using it in my application as a feed reader, was very easy to implement with a backend for defining feeds, I just loop them out and include the JS :) Tane On 4/20/07, Mike Alsup [EMAIL PROTECTED] wrote: To view the api example, you can open the file from the browser (no need to have a API key and put it on a server). Also, If someone has the time, a cool plugin idea is an RSS viewer. Here's a quick and dirty plugin to convert anchors into feed divs. Modify it to suit your needs: (function($) { $.fn.toFeed = function(options) { return this.each(function() { var opts = jQuery.extend({ url: this.href, max: 5 }, options || {}); var $this = $(this); var feed = new google.feeds.Feed(opts.url); feed.load(function(result) { if (!result.error) { var max = Math.min(result.feed.entries.length, opts.max); var f = $('div class=feed/div'); f.append('h1 class=feed'+result.feed.title+'/h1'); for (var i = 0; i max; i++) { var entry = result.feed.entries[i]; var title = entry.title; var snip = entry.contentSnippet; var link = entry.link; var date = entry.publishedDate; f.append('h2 class=feeditema href='+link+''+title+'/a/h2') .append('div class=feeddate'+date+'/div') .append('div class=feedsnip'+snip+'/div '); } $this.after(f).remove(); } }); }); }; })(jQuery); Here's a page that uses the above plugin: htmlhead style type=text/css #main { width: 300px } body { font-family: 'trebuchet ms'; color: #555; font-size: small; } div.feed { margin: 20px; padding: 20px; border: 1px dashed #ddd; background: #ffd } div.feeddate { font-size: smaller; color: #aaa } h1.feed { font-size: large; padding: 5px; margin: 2px 0; text-align: center } h2.feeditem { font-size: medium; padding: 0; margin: 2px 0 } /style script type=text/javascript src=../rel/jquery-1.1.2.js/script script type=text/javascript src=feed-from-above.js/script script type=text/javascript src=http://www.google.com/jsapi?key=[your key]/script script type=text/javascript google.load(feeds, 1); $(function() { $('a.feed').toFeed(); }); /script /head bodydiv id=main a class=feed href=http://jquery.com/blog/feed/;jQuery/a a class=feed href=http://feeds.feedburner.com/JohnResig;Resig/a a class=feed href=http://www.learningjquery.com/feed/;Learning jQuery/a /div/body /html
[jQuery] Image dynamic resizing
Hi, I need some script for dynamically resize an image with jquery. Are there any plugins to handle this? regards Adam
[jQuery] Re: Image dynamic resizing
I assume $('img').css({width:'100px'}); is not what you want. Are you asking for something with an image slider. ~Sean
[jQuery] Re: Image dynamic resizing
This is cool Remy. I can see it work like BritePic http://www.britepic.com/ Any plans on further adding other features for a full blown plug-in? -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Remy Sharp Sent: Friday, April 20, 2007 5:07 PM To: jQuery (English) Subject: [jQuery] Re: Image dynamic resizing I've just (like in the last 5 minutes) written a zoom plugin that will resize the image on the fly when requested. You could link a slider (Ext?) or input box to change the size and call the plugin against the image: http://remysharp.com/wp-content/uploads/2007/04/zoom.js On Apr 21, 12:21 am, Ad4m [EMAIL PROTECTED] wrote: Hi, I need some script for dynamically resize an image with jquery. Are there any plugins to handle this? regards Adam
[jQuery] Re: Best way to determine if a user has Javascript enabled?
Is it possible to submit a page back to itself using a regular submit button, then process the data from the form using taconite commands? I've run into a dead end. I can't seem to figure out how to submit a form with a regular submit button and then have taconite handle the data that comes back to the page. I'm using the script I was given to attach ?isAjax=true to my URL, and I was thinking that all I had to do was use taconite's replaceContent command to place the error messages back on the page with the form without refreshing the page. I've been thinking about this so long, I think I'm having a brain cramp. The problem seems to be that with a regular submission, I can't get the data being returned to the page in the xml format so taconite can parse it. I was given an example where all validation (no server-side validation) was done on a single page. The page was wrapped by: CFIF IsDefined(Form.Fieldnames) CFINCLUDE for cf processing of data CFCONTENT type=text/html reset=yes CFHEADER name=Content-Type value=text/xml CFOUTPUT oTaconite replaceContent for selects /CFOUTPUT CFELSE HTML xmlns=http://www.w3.org/1999/xhtml HEAD META http-equiv=Content-Type content=text/html; charset=iso-8859-1 / BODY Now the actual page content. scripts, including one that posts back to the same page ( I guess this is the Ajax post. $.post(CalcTest.cfm, Params); ), then the body, including the form (no submit button, everything is posted on blur) /BODY /HTML /CFIF The CFIF wrap of the page seems to prevent the return of non-xml data to the taconite plug-in, preventing what I'm getting now. XML Parsing Error: not well-formed. Am I just missing something or is it impossible to do this sort of thing at all if server-side processing is involved? I guess the question I have to have answered now is whether or not data can be sent back to the page that posted it in a form that the taconite plug-in can process it, if the data wasn't sent via Ajax from the page to begin with. Forgive me if this doesn't make any sense. it's not making much right now to me, either. I'm about ready to call it quits on client-side validation. I'm not sure it's worth all this trouble since server-side validation has to be performed anyway. Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Friday, April 20, 2007 6:55 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? Thanks for the feedback, Aaron. I'm trying to integrate the whole validation scheme into one page. I'm following an example given to me that does work, but using my own code, of course. I've got something wrong somewhere. I'll tinker some more and then if I can't figure it out, I'll post some code. Thanks for the tip. at least now I have some idea of what to look for! Rick From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Heimlich Sent: Friday, April 20, 2007 6:23 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best way to determine if a user has Javascript enabled? On 4/20/07, Rick Faircloth [EMAIL PROTECTED] wrote: The XML file does not appear to have any style information associated with it. The document tree is shown below. This is what FireFOX (not Firebug) does when you browse to an XML file that isn't using any XSLT stylesheets (and I would guess CSS as well, but I dunno). Seeing this doesn't necessarily mean that something went wrong, though (unless you're actually trying to use XSLT or something). Is the page in question supposed to return XML? If not, you should be sure that you're sending the appropriate Content-Type for whatever that page should be sending. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com
[jQuery] Re: Treeview persistence (cookies) and a dynamic (PHP/MySQL built) UL - not holding state
Just for P**ps and giggles, you might try packing the script yourself with Deal Edwards packer http://dean.edwards.name/packer/ It would help point in the direction of the problem with the compressed version you were using. JK -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of withinreach Sent: Friday, April 20, 2007 3:17 PM To: jQuery (English) Subject: [jQuery] Re: Treeview persistence (cookies) and a dynamic (PHP/MySQL built) UL - not holding state A bit more digging, and now I've gotten it to work, but Works fine, if I use the unpacked version of treeview.js that is in the SVN. If I replace that with the packed version, stops working. additional 6K won't break the bank, but makes you worry about version control WITHIN the latest releases. *sigh*
[jQuery] Re: Taconite question...
I'm having a strange issue on IE (isn't it almost always the culprit of issues). I'm returning this: taconite replaceContent select=#mystatus a href=# onClick=setStatus('mystatus', 'statusID', 'update status to this value');img src=/images/icons/check.gif width=16 height=16 border=0 //a /replaceContent replaceContent select=#mystatusDate dynamic date status created /replaceContent /taconite it's hard to see exactly what's coming in on IE without firebug but the items are getting updated. The problem comes when I try to click on the checkbox image the second time (after it was first called and the data is returned). However, that second time does nothing. The function setStatus is not being called (determined by putting an alert at the top of the function just to tell me it's being called). I would just use a bind click event, but the problem is that I have a dynamic number of statuses that have to pass specific values to the server in order to be processed. Since it was all working everywhere else, I thought I was good, until I tried in in IE. Any suggestions?
[jQuery] Re: Taconite question...
http://www.getfirebug.com/lite.html helps a lot. On Apr 20, 7:00 pm, Shelane [EMAIL PROTECTED] wrote: I'm having a strange issue on IE (isn't it almost always the culprit of issues). I'm returning this: taconite replaceContent select=#mystatus a href=# onClick=setStatus('mystatus', 'statusID', 'update status to this value');img src=/images/icons/check.gif width=16 height=16 border=0 //a /replaceContent replaceContent select=#mystatusDate dynamic date status created /replaceContent /taconite it's hard to see exactly what's coming in on IE without firebug but the items are getting updated. The problem comes when I try to click on the checkbox image the second time (after it was first called and the data is returned). However, that second time does nothing. The function setStatus is not being called (determined by putting an alert at the top of the function just to tell me it's being called). I would just use a bind click event, but the problem is that I have a dynamic number of statuses that have to pass specific values to the server in order to be processed. Since it was all working everywhere else, I thought I was good, until I tried in in IE. Any suggestions?
[jQuery] Re: Superfish, Tabs and IE z-index
On 21/04/2007, at 2:08 AM, Chris Scott wrote: Thanks Joel. Here's a demo page: http://iamzed.com/jquery/ superfishtabs.html I put the info. on what I customized from the default superfish.css on there. Hi Chris, thanks for the demo page it helped enormously. I found that applying the z-index:3 rule to an element further up the tree, such as .nav li, instead of .nav li ul, fixes the problem. I should probably have made a definitive CSS file for Superfish which takes as many possible issues like this into account and also makes the menu prettier by default. Truth be told, I just slapped that one together and expected folks to work out the CSS for the menu as they would have to without the Superfish plugin. Maybe Superfish would benefit from a more polished CSS file such as Klaus's brilliant Tabs plugin has. Thanks for bringing this to my attention Chris - I love the opportunity to further refine things. I will apply the fix to my demo page's Superfish CSS also. Joel Birch. P.S. the reason the tabs were jumping down on your demo page was because the #header element was switching between different hasLayout modes. Adding height:1% or something similar (I noticed you use display:inline-block instead) fixes that. I know you said your actual page does not have the problem, but knowing why it happens on your demo page may help you next time you run into that issue with IE.
[jQuery] Re: Taconite question...
Ahh. I'll have to wait until Monday to test firebug lite. It's not working in the crossover version of IE and I don't have access to a PC at the moment. Thanks for the link though. On 4/20/07 7:02 PM, Daemach [EMAIL PROTECTED] wrote: http://www.getfirebug.com/lite.html helps a lot. On Apr 20, 7:00 pm, Shelane [EMAIL PROTECTED] wrote: I'm having a strange issue on IE (isn't it almost always the culprit of issues). I'm returning this: taconite replaceContent select=#mystatus a href=# onClick=setStatus('mystatus', 'statusID', 'update status to this value');img src=/images/icons/check.gif width=16 height=16 border=0 //a /replaceContent replaceContent select=#mystatusDate dynamic date status created /replaceContent /taconite it's hard to see exactly what's coming in on IE without firebug but the items are getting updated. The problem comes when I try to click on the checkbox image the second time (after it was first called and the data is returned). However, that second time does nothing. The function setStatus is not being called (determined by putting an alert at the top of the function just to tell me it's being called). I would just use a bind click event, but the problem is that I have a dynamic number of statuses that have to pass specific values to the server in order to be processed. Since it was all working everywhere else, I thought I was good, until I tried in in IE. Any suggestions?
[jQuery] Re: Taconite question...
Shelane, I'm having a strange issue on IE (isn't it almost always the culprit of issues). I'm returning this: taconite replaceContent select=#mystatus a href=# onClick=setStatus('mystatus', 'statusID', 'update status to this value');img src=/images/icons/check.gif width=16 height=16 border=0 //a /replaceContent replaceContent select=#mystatusDate dynamic date status created /replaceContent /taconite it's hard to see exactly what's coming in on IE without firebug but the items are getting updated. The problem comes when I try to click on the checkbox image the second time (after it was first called and the data is returned). However, that second time does nothing. The function setStatus is not being called (determined by putting an alert at the top of the function just to tell me it's being called). I would just use a bind click event, but the problem is that I have a dynamic number of statuses that have to pass specific values to the server in order to be processed. Since it was all working everywhere else, I thought I was good, until I tried in in IE. Any suggestions? It sounds like you're running into this problem: http://groups.google.com/group/jquery-en/browse_frm/thread/3535a8ba195d0a37/ 9d05b60155ed547e?lnk=gstq=ext+clickrnum=2#9d05b60155ed547e If it is, then hopefully the problem will be resolved soon. Heck, it might already be fixed in the SVN--I haven't looked. -Dan