[jQuery] Re: progressive enhancement link href hurdle
I'm not aware of any native jQuery methods to deserialise your href query params but I'm sure someone could suggest a plug that does it. Perhaps you don't need to extract the params? Why not just set the url value in your ajax call to include the params from your href string, params and all, and ignore the data option? Or perhaps use url: rpc.php? + data.split(?)[1] Failing that you could tackle it using split() and arrays with code like this: Using your example: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a var href = $(A).attr(href);// Read the href attribute from the a tag (use your own selector here instead of A). var query = href.split(?); // Separate href string at the question mark. var params = query[1].split(); // Take all text that follows the question mark and separate it at the 's. You now have an array of name=value pairs that your could loop through and use. Eg use jQuery.each() You may then wish to copy the name=value pairs into an object/map. A shorthand for the 3 lines above might be: var params = $ (A).attr(href).split(?)[1].split(); (Code is untested and assumes there will always be query params in the href and only one question mark) Hope this helps George On Jan 14, 9:53 pm, toadeny [EMAIL PROTECTED] wrote: Hi All, I want to use a whole bunch of jQuery functionality on a website and still have it accessible in its current form. I believe the term for such a process is 'progressive enhancement' Correct me if I'm wrong but I understand about adding enhancements to an existing webapp is that: 1) There are three layers to a website: HTML,CSS and JS 2) Each layer adds more functionality/style/interaction than the last and these layers should be applied in order to all browsers than are compatible So with that in mind I went off to enhance my existing webapp. There are a lot of links on the website that i would like to turn into Ajax interactions. They are generally like this: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a I want to have an easy way of extracting all parameters from the href or maybe supplying an object in the a href for jQuery to parse: I thought of something like this which would be a matter of changing a few templates on the site: a class=addItem href=index.php?do=addid=1s=1 params={do:add,id: 1,s:1}Add Item 1/a I might well be completely off track but Is it legal (W3C) to just add your own attributes to a tag like this? Would this work and how would i get it into an object to use in my click function?: (i'm guessing here) Regardless of that here is my script thus far: HTML: html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jquery-1.2.1.min.js/script script type=text/javascript src=actions.js/script /head body h3Test/h3 div id=msg/div div id=loading/div div id=content a class=addItem href=index.php?do=addid=1s=1Add Item 1 Section 1/a a class=addItem href=index.php?do=addid=2s=2Add Item 2 Section 2/a a class=addItem href=index.php?do=addid=3s=3Add Item 3 Section 3/a /div /body /html JS: function doRPC(data) { $.ajax({ type: GET, url: rpc.php, data: data, error: function() { $('#msg').text('There was an error completing your request, please try again later.'));}, success: function(msg){ $('#msg').html(msg); }, } }); return false; }; $(document).ready(function() { $(a.addItem).click(function() { doRPC($(this).attr('href')); return false; } } At the moment the data sent to the server is something like this: Array([index.php?do=] = add [id] = 1 [s] = 1) Should i just deal with this ugly format in php and move on? Any help is appreciated. Thanks
[jQuery] **SPAM** Re: [jQuery] instant edit
Spam detection software, running on the system rio.rio.ee, has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Jan 15, 2008, at 3:32 AM, Lionel Martelly wrote: Why is the instant edit not editing please? When I click on it it allows me to edit but the text does not update at all. Thanks $(function() { $(.click).editable(save.php?do=instant, { id: head_420, indicator : img src=images/spinner.gif', tooltip : click to edit, style : inherit }); });b class=click id=head_420 style=display: inlineclick to edit/bif ($_REQUEST['do'] == 'instant') { $myvalue = $_REQUEST['value']; $head = $_REQUEST['head']; $arts = explode(_,$head); $artid = $articles[1];do db update here echo $myvalue; exit; [...] Content analysis details: (5.8 points, 2.5 required) pts rule name description -- -- -0.7 BAYES_05 BODY: Bayesian spam probability is 1 to 5% [score: 0.0207] 6.5 AWLAWL: From: address is in the auto white-list ---BeginMessage--- On Jan 15, 2008, at 3:32 AM, Lionel Martelly wrote: Why is the instant edit not editing please? When I click on it it allows me to edit but the text does not update at all. Thanks ---$(function() { $(.click).editable(save.php?do=instant, { id: head_420, indicator : img src=images/spinner.gif', tooltip : click to edit, style : inherit }); });-b class=click id=head_420 style=display: inlineclick to edit/bif ($_REQUEST['do'] == 'instant') { $myvalue = $_REQUEST['value']; $head = $_REQUEST['head']; $arts = explode(_,$head); $artid = $articles[1];do db update here echo $myvalue; exit; PHP part looks bit confusing to me. Have you checked with Firebug that values sent to PHP script are the values you are expecting? -- Mika Tuupola http://www.appelsiini.net/ ---End Message---
[jQuery] Re: progressive enhancement link href hurdle
there is a plugin that is quite useful for what you need: http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2/ please note that there is an error in the plugin code or a possible change since jquery.1.2.2b if ($(this).attr(”src”) != “undefined”) { does not work. It needs to be if ($(this).attr(”src”)) { same for the other IF conditions. HTH, alex -- Original Message -- To: jQuery (English) (jquery-en@googlegroups.com) From: George ([EMAIL PROTECTED]) Subject: [jQuery] Re: progressive enhancement link href hurdle Date: 15/1/2008 9:35:03 I'm not aware of any native jQuery methods to deserialise your href query params but I'm sure someone could suggest a plug that does it. Perhaps you don't need to extract the params? Why not just set the url value in your ajax call to include the params from your href string, params and all, and ignore the data option? Or perhaps use url: rpc.php? + data.split(?)[1] Failing that you could tackle it using split() and arrays with code like this: Using your example: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a var href = $(A).attr(href);// Read the href attribute from the a tag (use your own selector here instead of A). var query = href.split(?); // Separate href string at the question mark. var params = query[1].split(); // Take all text that follows the question mark and separate it at the 's. You now have an array of name=value pairs that your could loop through and use. Eg use jQuery.each() You may then wish to copy the name=value pairs into an object/map. A shorthand for the 3 lines above might be: var params = $ (A).attr(href).split(?)[1].split(); (Code is untested and assumes there will always be query params in the href and only one question mark) Hope this helps George On Jan 14, 9:53 pm, toadeny [EMAIL PROTECTED] wrote: Hi All, I want to use a whole bunch of jQuery functionality on a website and still have it accessible in its current form. I believe the term for such a process is 'progressive enhancement' Correct me if I'm wrong but I understand about adding enhancements to an existing webapp is that: 1) There are three layers to a website: HTML,CSS and JS 2) Each layer adds more functionality/style/interaction than the last and these layers should be applied in order to all browsers than are compatible So with that in mind I went off to enhance my existing webapp. There are a lot of links on the website that i would like to turn into Ajax interactions. They are generally like this: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a I want to have an easy way of extracting all parameters from the href or maybe supplying an object in the a href for jQuery to parse: I thought of something like this which would be a matter of changing a few templates on the site: a class=addItem href=index.php?do=addid=1s=1 params={do:add,id: 1,s:1}Add Item 1/a I might well be completely off track but Is it legal (W3C) to just add your own attributes to a tag like this? Would this work and how would i get it into an object to use in my click function?: (i'm guessing here) Regardless of that here is my script thus far: HTML: html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jquery-1.2.1.min.js/script script type=text/javascript src=actions.js/script /head body h3Test/h3 div id=msg/div div id=loading/div div id=content a class=addItem href=index.php?do=addid=1s=1Add Item 1 Section 1/a a class=addItem href=index.php?do=addid=2s=2Add Item 2 Section 2/a a class=addItem href=index.php?do=addid=3s=3Add Item 3 Section 3/a /div /body /html JS: function doRPC(data) { $.ajax({ type: GET, url: rpc.php, data: data, error: function() { $('#msg').text('There was an error completing your request, please try again later.'));}, success: function(msg){ $('#msg').html(msg); }, } }); return false; }; $(document).ready(function() { $(a.addItem).click(function() { doRPC($(this).attr('href')); return false; } } At the moment the data sent to the server is something like this: Array([index.php?do=] = add [id] = 1 [s] = 1) Should i just deal with this ugly format in php and move on? Any help is appreciated. Thanks Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com http://www.mediaruimte.be __ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the
[jQuery] Re: Attempts failing to cause div to slide up, slide down
Hi, Karl... I've tried various coding approaches to implement what described below, but everything has failed to meet expectations to this point. Could you provide an example of how you're thinking I should go about this? Also, would the new .bind(mouseenter)/.bind(mouseleave) functionality in the new jQuery 1.2.2 be more useful than .hover? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Sunday, January 13, 2008 6:47 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Hi Rick, You might want to attach one .hover() method to the UL instead of the LIs and have that one slide the other element down and up. Then, attach another .hover() to the LIs so that you can have different content displayed depending on which one is being hovered. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Method to convert dimenions value to ColdFusion variable?
Hi, That's what I meant when I said: 1. post it back to the server OR 2. set a cookie that can be read by the server-side script. I prefer to just set a cookie. If the cookie isn't set, I send the client a little script that will set it. But Ajax sounds like the best option in your case: 1. Load the the page without the dimension-sensitive content 2. Send dimensions to server via Ajax 3. The response is the HTML based on the dimensions sent 4. Insert the dimension-sensitive content Voila! (Warning: this would be terrible for SEO) On Jan 14, 10:28 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Hi, Diego... and thanks for the reply. I know that I can use the Dimensions plug-in to get exactly the data that I need, I'm just not sure how to get it back to the server. Ajax? Or I guess I could set a cookie and ColdFusion read it. An ajax method might seem to be more practical. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Diego A. Sent: Monday, January 14, 2008 4:44 PM To: jQuery (English) Subject: [jQuery] Re: Method to convert dimenions value to ColdFusion variable? There are components you can use, but usually, the only way is to use javascript on the client to calculate the dimensions and then 1. post it back to the server OR 2. set a cookie that can be read by the server-side script On Jan 14, 7:34 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Hi, all. I guess this would be aimed at those of us who use jQuery and ColdFusion, but. Is there a way to convert the dimensions of the browser window to a variables that ColdFusion can use? I'd like to try to get the browser window size of a user, and create an image on-the-fly using the new image handling tags in CF8 that would create the largest image possible for the browser window. To prevent the images based on browser window size from taking too long to display, I may create a variety of image sizes when the image is first uploaded and then just call the most appropriate image size for the browser window. (That would, however, take up a *lot* of disk space) Anyone know if this possible or has anyone done it? Thanks, Rick
[jQuery] 1.2.2 Released 20 minutes ago
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.2.pack.js
[jQuery] Re: jQuery Form Plugin, and ajax submit without submit button
So like this? form input type=checkbox name=whatever onClick='$ ('#form_id').ajaxSubmit()' /form http://groups.google.com/group/jquery-en/browse_thread/thread/b15fa8db4db5deeb
[jQuery] Issues in using getJSON menthod
HI all, I am trying to use the getJSON method to fetch data from a json file on clicking a link.Now i make a div element empty initially and after fetching the content i use $('#midbox').append($(html));.Now the updated contents are visible for a second then it reverts to the original contents of #midbox.Now i am not able to figure it out why this happens.This is my code snippet: snip $('ulliullia').click(function(){ var name=$(this).text(); var filename='js/'+ name + '.json'; $.getJSON(filename,function(data){ $('#midbox').empty(); $.each(data,function(entryIndex,entry){ var html='table width=430px cellspacing=3 cellpadding=3 border=0 '; html+='tr'; html+='td align=leftp class=heading'+entry['name']+ 'span class=maximise'; html+='/spanbr/p'; html+='div class=entry'+entry['Introduction']+'/div/td/ tr'; html+='tr'; html+='td align=leftp class=heading Rule span class=maximise'; html+='/spanbr/p'; html+='div class=entry'; html+='ul'; $.each(entry['rule'],function(lineIndex,line){ html+='li'+line+'/li'; }); html+='/ul/div/td/tr'; html+='/table'; $('#midbox').append($(html)); }); }); }); /snip
[jQuery] Trying to set the id of a 2nd level div and failing
I'm trying to set the id of a 2nd level obj selected by class and it doesn't seem to work as I thought it would. Unfortunately all of the level one objects get the id assignment, not the level two object. Here it is before I do the operation: div id=obj div class=obj_level1 div class=obj_level2/div /div div class=obj_level1.1/div /div Then I do this: var obj = $(#obj); //bunch of code obj.children(.obj_level1 .obj_level2).attr( id, Bob ); It ends up like this: div id=obj div id=Bob class=obj_level1 div class=obj_level2/div /div div id=Bob class=obj_level1.1/div /div Note the two divs with the same id. . . Do I have to use: obj.children(.obj_level1).children(.obj_level2).attr( id, Bob ); Originally I was using: $(#obj .obj_level1 .obj_level2).attr( id, Bob ); And that worked ok, but I needed the object in a variable as I and using it repeatedly and didn't want to dereference it every time I use it, for speed's sake. Any thoughts as to the correct syntax to do this? Thanks, ml
[jQuery] Re: jQuery Form Plugin, and ajax submit without submit button
This might be the answer we're looking for: http://groups.google.com/group/jquery-en/browse_thread/thread/961a893390a9f9b2
[jQuery] Re: jQuery 1.1.2 Released: Happy 2nd Birthday!
Subject line says 1.1.2. Thought this was a parody post.. :) Congrats on the 1.2.2 release (and the 1.1.2 as well, though that's a little belated.. LOL). I'm looking forward to working with it. Shawn John Resig wrote: On the 2nd birthday of jQuery we're happy to bring you a new release of jQuery! Here's the announcement: http://jquery.com/blog/2008/01/15/jquery-122-2nd-birthday-present/ and here's the release notes: http://docs.jquery.com/Release:jQuery_1.2.2 Enjoy - and here's looking forward to another year of excellent jQuery code! --John
[jQuery] animation :
animation : childrens like animation : http://padmagirl.blogspot.com
[jQuery] animation :
animation : childrens like animation : http://padmagirl.blogspot.com
[jQuery] How can I switch elements by fades?
$(function() { $(#message_1).clone().removeClass(hidden).appendTo($(#message)); $(span.text1).click(function() { $(#message).empty().html($(#message_1).clone().fadeIn(normal)); return false; }); $(span.text2).click(function() { $(#message).empty().html($(#message_2).clone().fadeIn(normal)); return false; }); }); From the script above, it works fine, but what I wanna do is to fade out the current element first, then the new element fades in afterwards. How to work it? Thank you -- View this message in context: http://www.nabble.com/How-can-I-switch-elements-by-fades--tp14832714s27240p14832714.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery 1.1.2 Released: Happy 2nd Birthday!
Happy Birthday JQuery and respects to Dev Team Stefan Petre wrote: Happy Birthday jQuery and congrats to dev team. 2008/1/15, Joel Birch [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: Waahh, happy birthday jQuery! My, how you have matured! Huge thanks to John, Brandon, David (a warm welcome to you), and all the other cool dudes in the jQuery team. Respect and admiration. Joel Birch.
[jQuery] simple ajax question
I have a small ajax issue here: function someFunc(){ var someVar = true; $.ajax({ type: GET, url: requestURL, success: function(msg){ } }); } I have 2 problems: 1. I want someFunc to return a value according to the result of the ajax request - e.g. if msg is empty to return true, otherwise false. But if I attempt to return something, actually the function(msg) returns it somewhere and I don't get any result, which is logical since I'm inside an anonymous function like function(msg). So i try to assign this variable someVar and then return it like: url: requestURL, success: function(msg){ someVar = false; } }); return someVar; but it returns true... i suppose someVar is returned before the request is completed... so I don't know what to do? Any suggestions? -- View this message in context: http://www.nabble.com/simple-ajax-question-tp14833721s27240p14833721.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: progressive enhancement link href hurdle
Thank you both for your replys. I have been doing more reading on the subject and a plugin would quite possibly bring in more overhead, thus the split is just what i need. I am and can assume that the site will always end up with a '?' and then the query string for the cases i am parsing. That works a treat! On Jan 15, 10:22 pm, Alexandre Plennevaux [EMAIL PROTECTED] wrote: there is a plugin that is quite useful for what you need: http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-versi... please note that there is an error in the plugin code or a possible change since jquery.1.2.2b if ($(this).attr(src) != undefined) { does not work. It needs to be if ($(this).attr(src)) { same for the other IF conditions. HTH, alex -- Original Message -- To: jQuery (English) (jquery-en@googlegroups.com) From: George ([EMAIL PROTECTED]) Subject: [jQuery] Re: progressive enhancement link href hurdle Date: 15/1/2008 9:35:03 I'm not aware of any native jQuery methods to deserialise your href query params but I'm sure someone could suggest a plug that does it. Perhaps you don't need to extract the params? Why not just set the url value in your ajax call to include the params from your href string, params and all, and ignore the data option? Or perhaps use url: rpc.php? + data.split(?)[1] Failing that you could tackle it using split() and arrays with code like this: Using your example: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a var href = $(A).attr(href);// Read the href attribute from the a tag (use your own selector here instead of A). var query = href.split(?); // Separate href string at the question mark. var params = query[1].split(); // Take all text that follows the question mark and separate it at the 's. You now have an array of name=value pairs that your could loop through and use. Eg use jQuery.each() You may then wish to copy the name=value pairs into an object/map. A shorthand for the 3 lines above might be: var params = $ (A).attr(href).split(?)[1].split(); (Code is untested and assumes there will always be query params in the href and only one question mark) Hope this helps George On Jan 14, 9:53 pm, toadeny [EMAIL PROTECTED] wrote: Hi All, I want to use a whole bunch of jQuery functionality on a website and still have it accessible in its current form. I believe the term for such a process is 'progressive enhancement' Correct me if I'm wrong but I understand about adding enhancements to an existing webapp is that: 1) There are three layers to a website: HTML,CSS and JS 2) Each layer adds more functionality/style/interaction than the last and these layers should be applied in order to all browsers than are compatible So with that in mind I went off to enhance my existing webapp. There are a lot of links on the website that i would like to turn into Ajax interactions. They are generally like this: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a I want to have an easy way of extracting all parameters from the href or maybe supplying an object in the a href for jQuery to parse: I thought of something like this which would be a matter of changing a few templates on the site: a class=addItem href=index.php?do=addid=1s=1 params={do:add,id: 1,s:1}Add Item 1/a I might well be completely off track but Is it legal (W3C) to just add your own attributes to a tag like this? Would this work and how would i get it into an object to use in my click function?: (i'm guessing here) Regardless of that here is my script thus far: HTML: html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jquery-1.2.1.min.js/script script type=text/javascript src=actions.js/script /head body h3Test/h3 div id=msg/div div id=loading/div div id=content a class=addItem href=index.php?do=addid=1s=1Add Item 1 Section 1/a a class=addItem href=index.php?do=addid=2s=2Add Item 2 Section 2/a a class=addItem href=index.php?do=addid=3s=3Add Item 3 Section 3/a /div /body /html JS: function doRPC(data) { $.ajax({ type: GET, url: rpc.php, data: data, error: function() { $('#msg').text('There was an error completing your request, please try again later.'));}, success: function(msg){ $('#msg').html(msg); }, } }); return false; }; $(document).ready(function() { $(a.addItem).click(function() { doRPC($(this).attr('href')); return false; } } At the moment the data sent to the server is something like this: Array([index.php?do=] = add [id] = 1 [s] = 1) Should i just deal with this ugly format in php and move on? Any help is appreciated. Thanks Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels
[jQuery] jQuery + PHP MCV Framework
Hi guys, is anyone there using jQuery with php mcv framework like CodeIgniter / Cake ? how do you guys solving the problem url param generated by jquery example: abc.php?c=controllerm=methodsp1=var1$p2=var2 into abc.php/controller/methods/var1/var2 any tips will be very useful for me. thx dian yn
[jQuery] cluetip - Plugin with .load() not working
Hi Jqueries The cluetip-Plugins works fine, as long as you have content and Script on the same page. But when it comes to use cluetip with the .load()-function, it's not working (no errors whatsoever). index.html-file in demo-folder: [code] $('#inc').load('inc.html', function(){ $('[EMAIL PROTECTED]').cluetip(); -- no response alert( 'file loaded!' ); -- works } ) [/code] inc.html: [code] pspan title=This text should show up in cluetipMouseover test (title)/span/p [/code] It does not help to put [code] $('[EMAIL PROTECTED]').cluetip(); [/code] in the $.document(ready)-Container Any suggestions? Am I missing something? Thanks for inputs and clues :-) QT
[jQuery] Re: jQuery 1.1.2 Released: Happy 2nd Birthday!
Happy birthday and congratulations and mainly thanks for jQuery, which has seriously changed my ideas about web programming. zizi On 1/14/08, John Resig [EMAIL PROTECTED] wrote: On the 2nd birthday of jQuery we're happy to bring you a new release of jQuery! Here's the announcement: http://jquery.com/blog/2008/01/15/jquery-122-2nd-birthday-present/ and here's the release notes: http://docs.jquery.com/Release:jQuery_1.2.2 Enjoy - and here's looking forward to another year of excellent jQuery code! --John -- ---{ zizi }---
[jQuery] Element by Name associative array
Hello all, I'm trying to get the value of an element by it's array key. input name='example[key]' / Any guidance would be appreciated. Thanks
[jQuery] Re: progressive enhancement link href hurdle
Speaking of Progressive Enhancement, there's a concept called Hijax. That means nothing else than simply ajaxifying links without altering the href attribute at all and instead using the given one. An example of that technique can be found here: http://stilbuero.de/jquery/history In your case that just means you're making XHR requests to index.php? do=addid=1s=1 instead of rpc.php?do=addid=1s=1. That would completely save you the hassle to deserialize parameters and hardcoding another URL into the doRPC function, which in the end makes the whole application easier to maintain I guess. In the backend you would be able to distinguish between an Ajax and a normal request by checking the header X-Requested-With: XMLHttpRequest and take action accordingly. Just a thought... --Klaus On Jan 14, 10:53 pm, toadeny [EMAIL PROTECTED] wrote: Hi All, I want to use a whole bunch of jQuery functionality on a website and still have it accessible in its current form. I believe the term for such a process is 'progressive enhancement' Correct me if I'm wrong but I understand about adding enhancements to an existing webapp is that: 1) There are three layers to a website: HTML,CSS and JS 2) Each layer adds more functionality/style/interaction than the last and these layers should be applied in order to all browsers than are compatible So with that in mind I went off to enhance my existing webapp. There are a lot of links on the website that i would like to turn into Ajax interactions. They are generally like this: a href=index.php?do=addid=1s=1Add Item 1 Section 1/a I want to have an easy way of extracting all parameters from the href or maybe supplying an object in the a href for jQuery to parse: I thought of something like this which would be a matter of changing a few templates on the site: a class=addItem href=index.php?do=addid=1s=1 params={do:add,id: 1,s:1}Add Item 1/a I might well be completely off track but Is it legal (W3C) to just add your own attributes to a tag like this? Would this work and how would i get it into an object to use in my click function?: (i'm guessing here) Regardless of that here is my script thus far: HTML: html xmlns=http://www.w3.org/1999/xhtml; head script type=text/javascript src=jquery-1.2.1.min.js/script script type=text/javascript src=actions.js/script /head body h3Test/h3 div id=msg/div div id=loading/div div id=content a class=addItem href=index.php?do=addid=1s=1Add Item 1 Section 1/a a class=addItem href=index.php?do=addid=2s=2Add Item 2 Section 2/a a class=addItem href=index.php?do=addid=3s=3Add Item 3 Section 3/a /div /body /html JS: function doRPC(data) { $.ajax({ type: GET, url: rpc.php, data: data, error: function() { $('#msg').text('There was an error completing your request, please try again later.'));}, success: function(msg){ $('#msg').html(msg); }, } }); return false; }; $(document).ready(function() { $(a.addItem).click(function() { doRPC($(this).attr('href')); return false; } } At the moment the data sent to the server is something like this: Array([index.php?do=] = add [id] = 1 [s] = 1) Should i just deal with this ugly format in php and move on? Any help is appreciated. Thanks
[jQuery] Re: simple ajax question
What you actually need is to do whatever someFunc does inside the success function. If it depends on the result of the ajax call, then forget someFunc and someVar. Why can't you just do it like this? $.ajax({ type: GET, url: requestURL, success: function(msg){ // do the thing someFunc does with someVar } }); On Jan 15, 8:26 am, Ilkinho [EMAIL PROTECTED] wrote: I have a small ajax issue here: function someFunc(){ var someVar = true; $.ajax({ type: GET, url: requestURL, success: function(msg){ } }); } I have 2 problems: 1. I want someFunc to return a value according to the result of the ajax request - e.g. if msg is empty to return true, otherwise false. But if I attempt to return something, actually the function(msg) returns it somewhere and I don't get any result, which is logical since I'm inside an anonymous function like function(msg). So i try to assign this variable someVar and then return it like: url: requestURL, success: function(msg){ someVar = false; } }); return someVar; but it returns true... i suppose someVar is returned before the request is completed... so I don't know what to do? Any suggestions? -- View this message in context:http://www.nabble.com/simple-ajax-question-tp14833721s27240p14833721 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: how can a text field be hidden based on condition
Thanks! but the values of this drop down box are dynamic and are coming from a DB. So I was wondering if jquery offers a method so that rather than doing '.val()' i could do something else so that I would get search on content of the option box rather than value. so for example option value=my_valcat/option So here i would like to see if the option contains 'cat' or starts with 'c' or something like that... Also, i know that jquery supports chained method but how does it work with logical operators like or || so in the example you have mentioned..what if i wanted to do a check for 'my value2' as well... I appreciate your help! On Jan 14, 8:39 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Something like below should work: if($('select[name=myDropdown] :selected').val() == 'my value'){ $('input[name=inputToBeHidden]').hide(); } On 1/14/08, Bhaarat Sharma [EMAIL PROTECTED] wrote: Hello, I'm a little new to jQuery. Is it possible to hide/disable a text field based on a certain value in a drop down box on the same page?? I'd appreciate if someone could either show me a similar example or guide a little. Thanks -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjaminsterling.com
[jQuery] jqmodal autosize to fit contained image in window
hi all! i was wondering if anyone had a go at having jqModal adapt its size to the image it is displaying? All my attempts failed miserably, if anyone has an idea i'm all ears :) Cheers, Alexandre
[jQuery] Re: another fade problem in IE
Its seens that all elements inside the faded div that dont have a position relative doesnt fade... I'll keep trying... On Jan 15, 10:10 am, alexanmtz [EMAIL PROTECTED] wrote: HI everyone, Im trying to make a fade between pages on a website using ajax. Everything works fine in firefox and safari. The navigation is completely this way. Im using the jQuery 1.2 In Internet Explorer, sometimes the div fade sometimes not... its really strange... sometimes fade some elements, another times not. I ready set hasLayout in the target css and give a explicity background-color. Any ideas???
[jQuery] Re: Forms AjaxSubmit: no error handling?
To add to my previous post: in FF I always get the 'success' alert. Groeten, Friso
[jQuery] Re: Weird bahaviour of validation plugin in a textarea used by fckeditor
Can anybody help me out? Thanks! On 7 Jan., 14:01, KnoxBaby [EMAIL PROTECTED] wrote: Hello, look at this page: http://www.jahlabs.de/jquery/test2/ I'm using validaiton plugin to validate the form, but there is the following weird behaviour: When I write something to the textbox and click on submit, the error occurs that I have to insert at least 5 characters (even though I have written more than this). Then I click in the textbox and without doin anything there, I click directly again the submit button and it works without any error message... What's wrong with it? thanks!
[jQuery] Re: Forms AjaxSubmit: no error handling?
Hi all, I struggled with this one all day. Could it be that error is broken when you try to do a file upload in FireFox? My HTML (fragment): tr tdBatch type:/td td select name=importtype option value=11/option !-- other option omitted for brevety -- /select /td /tr tr tdBestand:/td tdinput type=file name=file //td /tr tr td colspan=2input type=submit value=Importeren //td /tr My script: script type=text/javascript $(document).ready(function(){ var options = { error: function(){ alert('Error loading XML document'); }, success: function(){ alert('Success loading XML document'); } }; $('#myForm').ajaxForm(options); }); /script Seems to work in IE (7), but not in FF (2). Groeten, Friso
[jQuery] Re: Attempts failing to cause div to slide up, slide down
Alright... this is getting me close to the proper animation on each li in the menu. $(document).ready(function() { $('#menu-details').hide(); $('li').mouseover(function() { $('#menu-details').slideToggle(); return false; }); }); However, I've got to prevent every menu item from opening and closing the menu-details div if menu items are passed over quickly. My thought is to integrate the hoverIntent plugin. ??? Also, this doesn't tackle the issue of knowing what details should be displayed based on what li is be moused-over. I guess I could give each li a distinct id, such as #li-buyers, #li-sellers and then have the content hard-coded into the menu-details div's. I would also need to hard-code each menu-detail div with a separate id for now, such as #menu-detail-buyers, #menu-details-sellers... That seems like it would at least provide a working solution until I can figure out an ajax approach. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Tuesday, January 15, 2008 5:17 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Hi, Karl... I've tried various coding approaches to implement what described below, but everything has failed to meet expectations to this point. Could you provide an example of how you're thinking I should go about this? Also, would the new .bind(mouseenter)/.bind(mouseleave) functionality in the new jQuery 1.2.2 be more useful than .hover? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Sunday, January 13, 2008 6:47 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Hi Rick, You might want to attach one .hover() method to the UL instead of the LIs and have that one slide the other element down and up. Then, attach another .hover() to the LIs so that you can have different content displayed depending on which one is being hovered. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Cluetip ajaxProcess and .find Problem
Hi Chris, Sorry for the delay in responding to your issue with the plugin. To be honest, I haven't looked at the ajaxProcess part in a long time, so I've been procrastinating digging back into what might be going on there for you. While I suspect my confession won't inspire confidence, I did want to at least let you know that I've seen your emails and I'm not ignoring you. I'll take a look at it and get back to you by the end of the day today, even if I haven't been able to resolve anything by then. With sincere apology, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 13, 2008, at 6:13 PM, Chris Scott wrote: A bit more info. on this: with the latest nightly build, I don't get an error any longer, but I don't get the div w/that ID either. On Jan 11, 2008, at 10:28 AM, Chris Scott wrote: I'm using cluetip to pull a page via ajax and want to display only a certain div from the page (using an ID selector). If I use the defautl ajaxProcess code, it works normally and pulls in the entire page into the cluetip. However, when I modify it to use .find to narrow it down using the ID selector, I get the following error: ret[i].getElementsByTagName is not a function on line 1362 of jquery-latest.js Here's the code I'm using for ajaxProcess to grab the div by ID: $(#test2).cluetip({ sticky: true, ajaxProcess: function(data) { data = $(data).find(#def1); return data; } }); Here's a test page with the first link using the standard ajaxProcess code and the second using mine: http://hostorlando.com/test/cluetip.html I have a feeling I'm missing something obvious but I've banged my head against it for a while and haven't made any progress. Any suggestions much appreciated. -- Chris Scott Adaptive Hosting Solutions http://adaptivehostingsolutions.com/ -- Chris Scott Adaptive Hosting Solutions http://adaptivehostingsolutions.com/
[jQuery] Re: Attempts failing to cause div to slide up, slide down
Well, I tried this: $(document).ready(function() { $('#menu-details-index').hide(); $('#li-index').mouseover(function() { var answer = $('#menu-details-index'); if (answer.is(':not visible')) { answer.slideDown(); } $('#li-index').mouseout(function() { var answer = $('#menu-details-index'); if (answer.is(':visible')) answer.slideUp(); }) }); }); But now the #menu-details-index div won't stay open when I mouseout from the #li-index li. How would I keep the #menu-details-index open? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Tuesday, January 15, 2008 8:48 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Alright... this is getting me close to the proper animation on each li in the menu. $(document).ready(function() { $('#menu-details').hide(); $('li').mouseover(function() { $('#menu-details').slideToggle(); return false; }); }); However, I've got to prevent every menu item from opening and closing the menu-details div if menu items are passed over quickly. My thought is to integrate the hoverIntent plugin. ??? Also, this doesn't tackle the issue of knowing what details should be displayed based on what li is be moused-over. I guess I could give each li a distinct id, such as #li-buyers, #li-sellers and then have the content hard-coded into the menu-details div's. I would also need to hard-code each menu-detail div with a separate id for now, such as #menu-detail-buyers, #menu-details-sellers... That seems like it would at least provide a working solution until I can figure out an ajax approach. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Rick Faircloth Sent: Tuesday, January 15, 2008 5:17 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Hi, Karl... I've tried various coding approaches to implement what described below, but everything has failed to meet expectations to this point. Could you provide an example of how you're thinking I should go about this? Also, would the new .bind(mouseenter)/.bind(mouseleave) functionality in the new jQuery 1.2.2 be more useful than .hover? Thanks, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: Sunday, January 13, 2008 6:47 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Attempts failing to cause div to slide up, slide down Hi Rick, You might want to attach one .hover() method to the UL instead of the LIs and have that one slide the other element down and up. Then, attach another .hover() to the LIs so that you can have different content displayed depending on which one is being hovered. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: jQuery + PHP MCV Framework
CodeIgniters' alergy to GET params is bizarre. I don't have any code for you; my jQuery + CI stuff has all been dead simple for AJAX; I just create a special controller for the few ajax calls I make and generate the URLs whole rather than using params ... One of these days I need to dig in and come up with a better .htaccess rule set and router for CI since it's such a nice light weight framework otherwise... well, except its ActiveRecord implementation. ;) Scott On Jan 15, 2008 4:49 AM, dynegara [EMAIL PROTECTED] wrote: Hi guys, is anyone there using jQuery with php mcv framework like CodeIgniter / Cake ? how do you guys solving the problem url param generated by jquery example: abc.php?c=controllerm=methodsp1=var1$p2=var2 into abc.php/controller/methods/var1/var2 any tips will be very useful for me. thx dian yn -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: jQuery Form Plugin, and ajax submit without submit button
You haven't installed the plugin properly, or you haven't specified the action attribute of the form. double check everything and make sure you READ the jQuery Form plugin documentation: http://www.malsup.com/jquery/form/ On Jan 15, 1:14 pm, Giovanni Battista Lenoci [EMAIL PROTECTED] wrote: Diego A. ha scritto: Use the ajaxSubmit method: $('#form_id').ajaxSubmit() I've tried your way, but still have errors when I call $('#form_id').ajaxSubmit(): options.url.indexOf is not a function options.url += (options.url.indexOf('?') = 0 ? '' : '?') + q; jquery.form.js (line 209) If I submit the form with the submit button anything works.. Thank you.
[jQuery] Re: jqmodal autosize to fit contained image in window
ok i kind of managed, if anyone interested, i did it like this: $('a.jqmodal').bind('click',function(){ imgPreloader = new Image(); //var mOffset = $('#modalWindow').show().offset(); //$.log(mWidth = + mWidth); //$.log(mHeight = + mHeight); imgPreloader.onload = function(){ imgPreloader.onload = null; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; var w = $(window).width() - 100; var h = $(window).height() - 100; $.log('screen width =' +w); $.log('screen height =' +h); if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; } } else if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; } } var mWinWidth = parseFloat(imageWidth + 30); var mWinHeight = parseFloat(imageHeight + 60); var mWinTop = parseFloat((h- imageHeight))/2; var mWinLeft = parseFloat((w-imageWidth))/2; $.log('mWinTop =' +mWinTop); $.log('mWinLeft =' + mWinLeft); $('.jqmWindow').css({ margin: 0, width: mWinWidth + 'px', height: mWinHeight+'px', top: mWinTop+'px', left: mWinLeft + 'px' }); $img = img id='TB_Image' src=' + this.src + ' width=' + imageWidth + ' height=' + imageHeight + ' alt=''/; $('#modalTitle').html(this.title); $('#modalContent').html($img); $('#modalWindow').jqmShow(); } imgPreloader.src = $(this).attr(href); imgPreloader.title = $(this).attr(title); return false; });
[jQuery] Re: Page won't process with mouse in browser window
Update: Removing BlockUI eliminates the issue. Now, to figure out why... On Jan 14, 9:10 pm, steve love [EMAIL PROTECTED] wrote: Can anyone think of any reason why a page would completely stop while the mouse is in the browser window, but continue once you move the mouse off the page? As if I had to tell you, this is happening with IE 6. I'm working on a project with a couple other coders, so we're not exactly sure where or when the problem began. It hasn't released, so I can't show you examples. If I knew what in the code was causing the problem, I could give you some code to look at. The best I can do is give you a description and hope someone has seen this happen before. Basically, pages that involve any kind of processing, Ajax or otherwise, will stop dead in their tracks until you move the mouse away. 1. In the most visible example, a form is filled out completely and correctly and submitted using the Form plugin. 2. The screen goes dark as BlockUI kicks in, but it's stuck. 3. Move the mouse off the browser window and the BlockUI message appears. There's an animated gif to show the script is processing. 4. Move the mouse back onto the browser window and processing stops again. Even the gif animation stops dead. This happens on other pages as well, not just pages using BlockUI. There are other plugins in use that are called on every page: jqModal and dimensions. We've also got a javascript function that sets a timer after a period of inactivity, based on mouse movement and keypresses. I thought perhaps this had something to do with it, but even removing these functions didn't solve the issue. I apologize for the long post with no code, but maybe someone will have encountered something like this. Thanks in advance! Steve
[jQuery] Re: jqmodal autosize to fit contained image in window
Hi, Alexandre... I'm going to be working with having images sized as closely as possible to a user's browser window size and so I'm interested in what you're doing. I was wondering if the Dimensions plug-in might be helpful to simplify what you're trying to do. (And what I'll be trying to do, too. Your code is above my head, for sure). Anyway, I'm going to try to use the Dimensions plug-in, get the users browser size, return that to the server via AJAX or a cookie, then either dynamically create an appropriately size image or pull up one of several sizes that I've already created and stored on the server. Dynamically creating an image of significant size could be too slow. The drawback of creating multiple variations of an image and storing them on the server means sacrificing server space for the images. Not sure which way I'll go. This is for my photography and Real Estate websites. Most viewers want to see as large a photo as possible. And the large photos do have a powerful impact on a viewer. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: Tuesday, January 15, 2008 10:40 AM To: jQuery (English) Subject: [jQuery] Re: jqmodal autosize to fit contained image in window ok i kind of managed, if anyone interested, i did it like this: $('a.jqmodal').bind('click',function(){ imgPreloader = new Image(); //var mOffset = $('#modalWindow').show().offset(); //$.log(mWidth = + mWidth); //$.log(mHeight = + mHeight); imgPreloader.onload = function(){ imgPreloader.onload = null; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; var w = $(window).width() - 100; var h = $(window).height() - 100; $.log('screen width =' +w); $.log('screen height =' +h); if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; } } else if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; } } var mWinWidth = parseFloat(imageWidth + 30); var mWinHeight = parseFloat(imageHeight + 60); var mWinTop = parseFloat((h- imageHeight))/2; var mWinLeft = parseFloat((w-imageWidth))/2; $.log('mWinTop =' +mWinTop); $.log('mWinLeft =' + mWinLeft); $('.jqmWindow').css({ margin: 0, width: mWinWidth + 'px', height: mWinHeight+'px', top: mWinTop+'px', left: mWinLeft + 'px' }); $img = img id='TB_Image' src=' + this.src + ' width=' + imageWidth + ' height=' + imageHeight + ' alt=''/; $('#modalTitle').html(this.title); $('#modalContent').html($img); $('#modalWindow').jqmShow(); } imgPreloader.src = $(this).attr(href); imgPreloader.title = $(this).attr(title); return false; });
[jQuery] Re: Cluetip ajaxProcess and .find Problem
On Jan 15, 2008, at 9:28 AM, Karl Swedberg wrote: Hi Chris, Sorry for the delay in responding to your issue with the plugin. To be honest, I haven't looked at the ajaxProcess part in a long time, so I've been procrastinating digging back into what might be going on there for you. While I suspect my confession won't inspire confidence, I did want to at least let you know that I've seen your emails and I'm not ignoring you. I'll take a look at it and get back to you by the end of the day today, even if I haven't been able to resolve anything by then. Hi Karl, No problem, thanks for the update. In the mean time, I've been playing around with adding an option to have it use the ajax .load instead which takes in the URL and selector from the rel attribute. Works great in FF and Safari but not in IE--something w/my code since a plain .load with the same URL and selector works fine in IE. With sincere apology, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Jan 13, 2008, at 6:13 PM, Chris Scott wrote: A bit more info. on this: with the latest nightly build, I don't get an error any longer, but I don't get the div w/that ID either. On Jan 11, 2008, at 10:28 AM, Chris Scott wrote: I'm using cluetip to pull a page via ajax and want to display only a certain div from the page (using an ID selector). If I use the defautl ajaxProcess code, it works normally and pulls in the entire page into the cluetip. However, when I modify it to use .find to narrow it down using the ID selector, I get the following error: ret[i].getElementsByTagName is not a function on line 1362 of jquery-latest.js Here's the code I'm using for ajaxProcess to grab the div by ID: $(#test2).cluetip({ sticky: true, ajaxProcess: function(data) { data = $(data).find(#def1); return data; } }); Here's a test page with the first link using the standard ajaxProcess code and the second using mine: http://hostorlando.com/test/cluetip.html I have a feeling I'm missing something obvious but I've banged my head against it for a while and haven't made any progress. Any suggestions much appreciated. -- Chris Scott Adaptive Hosting Solutions http://adaptivehostingsolutions.com/ -- Chris Scott Adaptive Hosting Solutions http://adaptivehostingsolutions.com/ -- Chris Scott Adaptive Hosting Solutions http://adaptivehostingsolutions.com/
[jQuery] Re: jqmodal autosize to fit contained image in window
-- Original Message -- To: Jquery-en (jquery-en@googlegroups.com) From: Rick Faircloth ([EMAIL PROTECTED]) Subject: [jQuery] Re: jqmodal autosize to fit contained image in window Date: 15/1/2008 16:51:16 Hi, Alexandre... I'm going to be working with having images sized as closely as possible to a user's browser window size and so I'm interested in what you're doing. I was wondering if the Dimensions plug-in might be helpful to simplify what you're trying to do. (And what I'll be trying to do, too. Your code is above my head, for sure). Anyway, I'm going to try to use the Dimensions plug-in, get the users browser size, return that to the server via AJAX or a cookie, then either dynamically create an appropriately size image or pull up one of several sizes that I've already created and stored on the server. Dynamically creating an image of significant size could be too slow. The drawback of creating multiple variations of an image and storing them on the server means sacrificing server space for the images. Not sure which way I'll go. This is for my photography and Real Estate websites. Most viewers want to see as large a photo as possible. And the large photos do have a powerful impact on a viewer. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: Tuesday, January 15, 2008 10:40 AM To: jQuery (English) Subject: [jQuery] Re: jqmodal autosize to fit contained image in window ok i kind of managed, if anyone interested, i did it like this: $('a.jqmodal').bind('click',function(){ imgPreloader = new Image(); //var mOffset = $('#modalWindow').show().offset(); //$.log(mWidth = + mWidth); //$.log(mHeight = + mHeight); imgPreloader.onload = function(){ imgPreloader.onload = null; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; var w = $(window).width() - 100; var h = $(window).height() - 100; $.log('screen width =' +w); $.log('screen height =' +h); if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; } } else if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; } } var mWinWidth = parseFloat(imageWidth + 30); var mWinHeight = parseFloat(imageHeight + 60); var mWinTop = parseFloat((h- imageHeight))/2; var mWinLeft = parseFloat((w-imageWidth))/2; $.log('mWinTop =' +mWinTop); $.log('mWinLeft =' + mWinLeft); $('.jqmWindow').css({ margin: 0, width: mWinWidth + 'px', height: mWinHeight+'px', top: mWinTop+'px', left: mWinLeft + 'px' }); $img = img id='TB_Image' src=' + this.src + ' width=' + imageWidth + ' height=' + imageHeight + ' alt=''/; $('#modalTitle').html(this.title); $('#modalContent').html($img); $('#modalWindow').jqmShow(); } imgPreloader.src = $(this).attr(href); imgPreloader.title = $(this).attr(title); return false; }); it's not that difficult after all: jquery core provides teh width() and height(), that's all you need. Dimension is not needed for this. you get the available screen space just like that: $(window).width() and $(window).height() then basically, you create an image object imgPreloader = new Image(); and when that object is loaded, you check its size and compare it to the window, then modify the image size and the modal window size so that it nicely fits inside the screen space. that's what my code does at least... Alexandre
[jQuery] Re: Weird bahaviour of validation plugin in a textarea used by fckeditor
You say the error occurs. What is the error? That's probably why people haven't replied to help. When you need help, it helps to be as clear and concise as possible. Anyway, I assume the problem is that you're trying to submit the contents of FCKEditor via ajax. This is not possible without explicitly updating the value of the textarea with the contents of the FCKEditor instance it points to. I think you need this: http://www.fyneworks.com/jquery/FCKEditor/ NOTE: the jQuery FCKEditor Plugin intercepts the ajaxSubmit function of the form plugin and explicitly updates the value of the textarea to be submitted. On Jan 15, 1:05 pm, KnoxBaby [EMAIL PROTECTED] wrote: Can anybody help me out? Thanks! On 7 Jan., 14:01, KnoxBaby [EMAIL PROTECTED] wrote: Hello, look at this page: http://www.jahlabs.de/jquery/test2/ I'm using validaiton plugin to validate the form, but there is the following weird behaviour: When I write something to the textbox and click on submit, the error occurs that I have to insert at least 5 characters (even though I have written more than this). Then I click in the textbox and without doin anything there, I click directly again the submit button and it works without any error message... What's wrong with it? thanks!
[jQuery] Re: [ANNOUNCE] jQuery.tabindex plugin
Colin, Recently I've been working on a plugin for jQuery that will make adding keyboard accessibility to your user interfaces a lot easier. In the process of working on this, I ran into a number of inconsistencies in the way that browsers handle the tabindex attribute. Getting, setting, and checking for the presence of tabindex is a pretty common task for handling keyboard accessibility, so I decided to roll this into a little plugin for jQuery. I've documented the plugin on my blog, but here's a quick summary of how to use it: jQuery().tabindex() // Returns the tabindex value of the first matched element, or undefined if no tabindex has been set. jQuery().tabindex(value) // Sets the tabindex value all matched elements. This will take either a String or a Number, but valid tabindex values should be -1, 0, or a positive integer. jQuery().removeTabindex() // Removes the tabindex attribute altogether from all matched elements. jQuery().hasTabindex() // Returns true if the first matched element has a tabindex value, false if not. More details available at: http://fluidproject.org/blog/2008/01/11/jquery-tabindex-plugin/ It looks like there's a little bit of cross over between what you're doing and tabIndex functions I have in the Field plug-in: http://jquery.com/plugins/project/field There are some key differences, as my methods are geared to navigate between form fields only. However, perhaps you might find some code in the Field plug-in that you might find useful. The methods you'd be interested in are: $(#formName).autoAdvance();* The autoAdvance() will search through the matching elements in the selector for any text-based input fields. It will then apply an onkeyup event that will take the user to the next field in the tabIndex (within the context of the form) when the maxlength value of the field has been reached. $([EMAIL PROTECTED]'users']).moveNext();* This would move the focus to the next field in the tabIndex array from the users field. If the next tabItem is outside of the form's context, the first element in the form will be selected. $([EMAIL PROTECTED]'users']).movePrev();* This would move the focus to the previous field in the tabIndex array from the users field. If the previous tabItem is outside of the form's context, the last element in the form will be selected. $([EMAIL PROTECTED]'users']).moveIndex(3);* This would move the focus to the third element in the tabIndex array. If the value 3 is outside the tabIndex array for the current form, then the last field would be selected. $([EMAIL PROTECTED]'users']).getTabIndex();* This returns the tabIndex for the current field as it relates to the parent form object. -Dan
[jQuery] Re: jqmodal autosize to fit contained image in window
jquery core provides teh width() and height(), that's all you need. Dimension is not needed for this. you get the available screen space just like that: $(window).width() and $(window).height() then basically, you create an image object imgPreloader = new Image(); and when that object is loaded, you check its size and compare it to the window, then modify the image size and the modal window size so that it nicely fits inside the screen space. that's what my code does at least... That sounds good, Alexandre. Are you returning a the imgPreloader variable back to the server to process your image server-side, or is everything being done on the fly client-side? Well, after looking more closely at your code, I can see you're setting the img attributes based on the window dimensions... good idea. I'll have an even closer look at your code. Thanks for sharing! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: Tuesday, January 15, 2008 11:02 AM To: Jquery-en Subject: [jQuery] Re: jqmodal autosize to fit contained image in window -- Original Message -- To: Jquery-en (jquery-en@googlegroups.com) From: Rick Faircloth ([EMAIL PROTECTED]) Subject: [jQuery] Re: jqmodal autosize to fit contained image in window Date: 15/1/2008 16:51:16 Hi, Alexandre... I'm going to be working with having images sized as closely as possible to a user's browser window size and so I'm interested in what you're doing. I was wondering if the Dimensions plug-in might be helpful to simplify what you're trying to do. (And what I'll be trying to do, too. Your code is above my head, for sure). Anyway, I'm going to try to use the Dimensions plug-in, get the users browser size, return that to the server via AJAX or a cookie, then either dynamically create an appropriately size image or pull up one of several sizes that I've already created and stored on the server. Dynamically creating an image of significant size could be too slow. The drawback of creating multiple variations of an image and storing them on the server means sacrificing server space for the images. Not sure which way I'll go. This is for my photography and Real Estate websites. Most viewers want to see as large a photo as possible. And the large photos do have a powerful impact on a viewer. Thoughts? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: Tuesday, January 15, 2008 10:40 AM To: jQuery (English) Subject: [jQuery] Re: jqmodal autosize to fit contained image in window ok i kind of managed, if anyone interested, i did it like this: $('a.jqmodal').bind('click',function(){ imgPreloader = new Image(); //var mOffset = $('#modalWindow').show().offset(); //$.log(mWidth = + mWidth); //$.log(mHeight = + mHeight); imgPreloader.onload = function(){ imgPreloader.onload = null; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; var w = $(window).width() - 100; var h = $(window).height() - 100; $.log('screen width =' +w); $.log('screen height =' +h); if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; } } else if (imageHeight h) { imageWidth = imageWidth * (h / imageHeight); imageHeight = h; if (imageWidth w) { imageHeight = imageHeight * (w / imageWidth); imageWidth = w; } } var mWinWidth = parseFloat(imageWidth + 30); var mWinHeight = parseFloat(imageHeight + 60); var mWinTop = parseFloat((h- imageHeight))/2; var mWinLeft = parseFloat((w-imageWidth))/2; $.log('mWinTop =' +mWinTop); $.log('mWinLeft =' + mWinLeft); $('.jqmWindow').css({ margin: 0, width: mWinWidth + 'px', height: mWinHeight+'px', top: mWinTop+'px', left:
[jQuery] Re: [ANNOUNCE] jQuery.tabindex plugin
Colin, [clip] As mentioned, I'm working on a larger plugin that helps add keyboard handlers for focusing and selecting items with the Tab key and arrow keys, making it easier to support common accessibility keystrokes in your UIs. It's still a work in progress, but please feel free to take a look and share your thoughts. My blog entry provides more details about the API and how to use it. There are a few bugs to fix, a few more methods to add, and I'll be moving all of the code out of the fluid.access namespace and making the low-level API private to the plugin. I'll send an announcement when it's closer to being ready, but let me know if you're interested in collaborating on it. https://source.fluidproject.org/svn/sandbox/tabindex/trunk/KeyboardHandlers .js https://source.fluidproject.org/svn/sandbox/tabindex/trunk/jquery.keyboard- a11y.js https://source.fluidproject.org/svn/sandbox/tabindex/trunk/jquery.keyboard -a11y.js You might also want to check out the Keynav plug-in: http://amountaintop.com/project/keynav It has some interesting code to determine the closest navigable element. The core problem I've found with the algorithm is that it calculates everything from the dead center of the element--which can provide unexpected behavior. I've been modding the code to find the element which has the closest edge (instead of based solely on the middle of the DOM element.) This provides a more predictable behavior. Using the middle of the DOM element works fine when all the elements are similarly sized block elements, but doesn't work well when lengths vary. I'm definitely interested in the work you're doing, since I'm currently working on an application where keyboard navigation is a high priority. -Dan
[jQuery] Re: jqmodal autosize to fit contained image in window
Are you returning a the imgPreloader variable back to the server to process your image server-side, or is everything being done on the fly client-side? nope, all done on the client side Well, after looking more closely at your code, I can see you're setting the img attributes based on the window dimensions... good idea. I'll have an even closer look at your code. indeed, in fact i measure the screen, i measure the image, i compare the two and get the maximum size the image can take (maximum being 1:1, not overstretching the image otherwise the image would look crapy), i add a few pixels for the modal div's width and height so that it visualy contains the image. good luck! alex
[jQuery] [OFF TOPIC] Really weird Behaviour in IE
I just found the oddest behaviour in IE6. If you have an a tag with content that is a domain name e.g. : a href='www.google.com'www.google.com/a if you set the href attribute (via jquery or natively) to another domain name - it will change the innerHTML to reflect this. E.G. $('a').attr(href, www.yahoo.com) will turn this into a href='www.yahoo.com'www.yahoo.com/a If the innerHTML is not a domain. then it won't do this. You can see that the IE programmers we obviously trying to do something helpful here - but too much magic is a bad thing : just wasted 1/2 an hour on this . Jonah
[jQuery] Re: Element by Name associative array
By array key do you mean the nuber, the index in the array? You can view the actual jQuery object created with a selector using firebug or ms script editor. So for instance in firebug, you click on script on the left. Then add a new watch expression on the right. Put in $(input) and press enter. That will give you the whole array object from jQuery. I hope this is helpful, Glen On Jan 15, 2008 2:10 AM, Ryan [EMAIL PROTECTED] wrote: Hello all, I'm trying to get the value of an element by it's array key. input name='example[key]' / Any guidance would be appreciated. Thanks
[jQuery] Re: [OFF TOPIC] Really weird Behaviour in IE
What happens when you you have an http:// in there? Your href should never just be www.somedomain.com anyway as that will attempt to load that as a document in the current domain's directory structure. andy -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of weepy Sent: Tuesday, January 15, 2008 10:49 AM To: jQuery (English) Subject: [jQuery] [OFF TOPIC] Really weird Behaviour in IE I just found the oddest behaviour in IE6. If you have an a tag with content that is a domain name e.g. : a href='www.google.com'www.google.com/a if you set the href attribute (via jquery or natively) to another domain name - it will change the innerHTML to reflect this. E.G. $('a').attr(href, www.yahoo.com) will turn this into a href='www.yahoo.com'www.yahoo.com/a If the innerHTML is not a domain. then it won't do this. You can see that the IE programmers we obviously trying to do something helpful here - but too much magic is a bad thing : just wasted 1/2 an hour on this . Jonah
[jQuery] Re: How can I switch elements by fades?
Use the fadeOut callback. http://docs.jquery.com/API/1.1/Effects#fadeOut.28_speed.2C_callback_.29 This will start a function when the animation for the fadeOut is finished. Then fadeIn the other one. Glen On Jan 14, 2008 10:22 PM, DeaR [EMAIL PROTECTED] wrote: $(function() { $(#message_1).clone().removeClass(hidden).appendTo($(#message)); $(span.text1).click(function() { $(#message).empty().html($(#message_1).clone().fadeIn(normal)); return false; }); $(span.text2).click(function() { $(#message).empty().html($(#message_2).clone().fadeIn(normal)); return false; }); }); From the script above, it works fine, but what I wanna do is to fade out the current element first, then the new element fades in afterwards. How to work it? Thank you -- View this message in context: http://www.nabble.com/How-can-I-switch-elements-by-fades--tp14832714s27240p14832714.html Sent from the jQuery General Discussion mailing list archive at Nabble.com .
[jQuery] Re: jqmodal autosize to fit contained image in window
Sounds good... good luck to you, too! Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: Tuesday, January 15, 2008 11:41 AM To: Jquery-en Subject: [jQuery] Re: jqmodal autosize to fit contained image in window Are you returning a the imgPreloader variable back to the server to process your image server-side, or is everything being done on the fly client-side? nope, all done on the client side Well, after looking more closely at your code, I can see you're setting the img attributes based on the window dimensions... good idea. I'll have an even closer look at your code. indeed, in fact i measure the screen, i measure the image, i compare the two and get the maximum size the image can take (maximum being 1:1, not overstretching the image otherwise the image would look crapy), i add a few pixels for the modal div's width and height so that it visualy contains the image. good luck! alex
[jQuery] [TABS plugin RELATED] Look mum, TABS layout only with CSS !!
Looking at official TABs plugin, I realized that the HTML structure is not very natural. It uses a list (UL) of tab headers follow by tab bodies (DIV). Normally, what you get from your favorite CMS is something more like : a header (div, h,...), its body (div), another header (div, h, ...), its body (div), etc... My challenge was, using this last natural HTML structure, try to layout it in a TABs way. I think I've got it: http://www.ita.es/jquery/tabs_only_css.htm , where practically I have used the same HTML for all 8 TABS combinations. The result is compatible with IE6, IE7, FF and Opera. But there are some limitations to take into account when implementing as a Jquery plugin (as I wish, ;-): * Only versions topRight, topLeft, leftTop and rightTop are100% automatic (CSS doesn't depend on TABs number, height and width). * Versions leftBottom, rightBottom, bottomLeft and bottomRight depends on TABS number, and the height and/or width applied (This is very jquerysh-able) * I used QUIRK format (see doctype in HTML) for IE: the same CSS for IE6 and IE7, but in STRICT format it would only work in IE7 (I don't control IE6 by now) * Body TABs height is fixed (100px) and scroll appears where content doesn't fit. In case of non-liquid TABs, with fixed width, it could be possible to automatically calculate height for no-scroll body via jquery-script with 3 modes: * 1. height fixed: like now in the example. 2. height max: fixed to maximum no-scroll body TAB height. 3. height auto: calculating each no-scroll body TAB height. With all this, next steps would be: to search a little more for IE6 STRICT mode compatibility, and to create a Jquery plugin (with CSS dinamically generated?) Any suggestions, help, critics, comments, are very welcome. -- Enrique Meléndez Estrada (2367) Servicios Informáticos Organización y Servicios Internos Instituto Tecnológico de Aragón
[jQuery] Re: trying in a function to change css color on divs
Thanks for your answer. Well it looks good but what i'm trying to do is to take the name of the selected input field $('input[name$=the selected input name]').change(function(){ and change the div whoms #id is the same name of the input name. so the second part is ok $('#'+this.name).css('background-color', this.value); thanks Rag On Jan 14, 4:50 pm, Eric Martin [EMAIL PROTECTED] wrote: How about: script type=text/javascript $(document).ready(function () { $('input[name$=bgcolor]').change(function(){ $('#'+this.name).css('background-color', this.value); });}); /script /head body input type=text name=body_bgcolor class=update value= class=texte style=width:50px; / input type=text name=header_bgcolor class=update value= class=texte style=width:50px; / div id=body_bgcolor h1test/h1 /div div id=header_bgcolor h1test/h1 /div /body I wasn't exactly clear on what you were trying to do, but hopefully the above should help. -Eric On Jan 14, 3:57 am,hollow[EMAIL PROTECTED] wrote: Hi, I'm trying to change color on a div from the change of an input field. what i need is to get the name of the input field that is the same as the div name ( and the value, to be able to do the change). to avoid repeating i'm trying to create one function that can handle all. the html part: input type=text id=body_bgcolor name=body_bgcolor class=update value=?echo $body_bgcolor1 ? class=texte style=width:50px; / input type=text id=header_bgcolor name=header_bgcolor class=update value=?echo $header_bgcolor1 ? class=texte style=width:50px; / $([EMAIL PROTECTED])].change(function(){ $(#inputthedivid).css('background-color',' set the new color'); }); If someone has any ideas on how to do this. Thanks Rag
[jQuery] Re: AJAX and javascript?
Hey, thanks for the reply... I found a couple of other people out there that have had the same issue (maybe), but not many The IE page returns the following code when it attempts to retrieve the ajax content script id=__ie_init defer=true src=//:/script There are some hacks out there, but I do not believe I am implementing them properly Basically, the problem occurs every single time I call JS function on the AJAX page Anyone seen this before and fixed it? script id=__ie_init defer=true src=//:/script
[jQuery] Re: Problems with Interface Sortables
Ok, if nobody has any suggestions for my problem, is there another way that I can allow users to re-order elements on screen and get the order of those elements upon form submission?
[jQuery] Re: AJAX and javascript?
Fixed! I have implemented the outstanding fix for this problem: It was referenced in the uncompressed version of jquery's latest version The fix is located on this site: http://javascript.nwbox.com/IEContentLoaded/ If any other noobs, such as myself, ever have this problem and not sure how to fix, just take the iecontentloaded.js from the site mentioned in the above line and implement it on the offending page that you are retrieving content from. You can do this on the page or calling from another .js file. I'm glad there are smart people in this world you understand things that I have no clue what's going on :)
[jQuery] Adding div
I have this code so far: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=http://code.jquery.com/jquery-latest.js;/script script $(document).ready(function(){ $(document.body).click(function () { if ($(div:first).is(:hidden)) { $(div).slideDown(slow); } else { $(div).hide(); } }); }); /script style div{ background:#00; margin:3px; width:960px; height:40px; display:none; float:left; padding:15px 10px 0 0; text-align:right; } /style /head body ul lia href=#Search Site/a/li lia href=#Search Blog/a/li /ul div id=google_search !-- Google CSE Search Box Begins -- form action=http://www.google.com/cse; id=searchbox_015980814770052224501:fkp-cgqshuk input type=hidden name=cx value=015980814770052224501:fkp- cgqshuk / input type=text name=q size=25 / input type=submit name=sa value=Search / /form script type=text/javascript src=http://www.google.com/coop/cse/ brand?form=searchbox_015980814770052224501%3Afkp-cgqshuklang=en/ script !-- Google CSE Search Box Ends -- /div div id=blog_search !-- Wordpress blog search -- form name=input action=# method=get Search: input type=text name=user input type=submit value=Submit /form /div /body /html I need some help with the code. First: I want the code to display the div id=google_search when the user clicks on the 'Search Site link And div id=blog_search for when they press Search Blog, only displaying one at a time, not both at the same time. Second: When I click in the search fields the div disappears. How can I get rid of that so the user can enter a search into the box, but still have the ability to click anywhere on the body to make that div disappear. Kind Regards
[jQuery] [ANNOUNCE]: SimpleModal v1.1.1 released
Contains a couple bug fixes: * Fixed overlay height and width detection in IE6 * Added a modalData class attribute to dialog.data * Added check for dialog object in close() - Prevents JS errors if called when dialog is already closed * Updated tests and demos to jQuery 1.2.2 and SimpleModal 1.1.1 * Updated test and demo css -Eric On Jan 4, 2:36 pm, Eric Martin [EMAIL PROTECTED] wrote: Hello, I've released a new version ofSimpleModal. I added some new options that allow direct CSS styling as well as moved the critical CSS attributes from external stylesheets into the script. Another big change is the way that the modal dialog data is handled. Now,SimpleModalwill, by default, clone the data and then re-insert the cloned data into the DOM when the dialog is closed. There is a new option, persist, which will allow you to have changes to the data maintained across modal calls. Project link:http://plugins.jquery.com/project/SimpleModal Homepage:http://www.ericmmartin.com/projects/simplemodal/ In addition, I'm working on a contact form plugin for WordPress that will be based on the Contact Form demo. You can see it in action on my site. I appreciate any feedback. Thanks, Eric
[jQuery] Re: instant edit
I just spent a tremendous amount of time trying to figure out what's wrong. I was supposed to hit enter instead of living the field. Is there a way to keep the value without having to do enter? e.g. by clicking outside of textbox? - Original Message - From: Lionel Martelly [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Monday, January 14, 2008 8:32 PM Subject: [jQuery] instant edit hi, Why is the instant edit not editing please? When I click on it it allows me to edit but the text does not update at all. Thanks ---$(function() { $(.click).editable(save.php?do=instant, { id: head_420, indicator : img src=images/spinner.gif', tooltip : click to edit, style : inherit }); });-b class=click id=head_420 style=display: inlineclick to edit/bif ($_REQUEST['do'] == 'instant') { $myvalue = $_REQUEST['value']; $head = $_REQUEST['head']; $arts = explode(_,$head); $artid = $articles[1];do db update here echo $myvalue; exit;
[jQuery] Re: jQuery 1.1.2 Released: Happy 2nd Birthday!
Thanks for all of the hard work. On Jan 14, 11:05 pm, John Resig [EMAIL PROTECTED] wrote: On the 2nd birthday of jQuery we're happy to bring you a new release of jQuery! Here's the announcement:http://jquery.com/blog/2008/01/15/jquery-122-2nd-birthday-present/ and here's the release notes:http://docs.jquery.com/Release:jQuery_1.2.2 Enjoy - and here's looking forward to another year of excellent jQuery code! --John
[jQuery] Re: 1.2.2 Released 20 minutes ago
Beta testers: How stable is this? Should I switch from 1.2.1 yet? On Jan 14, 8:23 pm, Up-Works [EMAIL PROTECTED] wrote: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.2
[jQuery] using resizable handles that are not children
i posted this over at jqueryUI forum, but there doesnt seem to be a whole lot of acitvity over there. the problem is here- http://groups.google.com/group/jquery-ui/browse_thread/thread/653876bcc27ade9b
[jQuery] detecting keystrokes for ie
hi, i'm using yahoo autocomplete from an input field and jquery to detect keystroke to trigger function. Everything works fine with the enter key, but it doesn't work for the tab key (both firefox/navigator and ie). Here's my code: $(#ysearchinput).keyup(function(e){ if(e.keyCode==13){//(e.keyCode==9) doesn't trigger anything taglia(); } }); I also tried with blur and it works fine in firefox/navigator but not in ie it looks like it calls the function twice $(#ysearchinput).blur(function(){ taglia(); }); A page where you can check this http://www.azero.dyndns.org/web/registrazioni/temp_registrati.php Go to the second fieldset, check the italia radiobutton and fill the Ricerca la località input field. Choose a place trying with the enter key, the tab key and clicking with the mouse the see the difference. Any idea why ie works like this? Thanks vitto
[jQuery] Re: Problems with Interface Sortables
Ok, I got it fixed. For anybody else who may be having the same issues, try removing the following from your Sortable setup: containment: 'parent' that is what was breaking the script, not sure why, but it was.
[jQuery] Re: jQuery + PHP MCV Framework
I just change the url in the plugins ajax calls. It isn't that difficult to find and change. -- David dynegara schreef: Hi guys, is anyone there using jQuery with php mcv framework like CodeIgniter / Cake ? how do you guys solving the problem url param generated by jquery example: abc.php?c=controllerm=methodsp1=var1$p2=var2 into abc.php/controller/methods/var1/var2 any tips will be very useful for me. thx dian yn
[jQuery] Re: jQuery Form Plugin, and ajax submit without submit button
options.url.indexOf is not a function options.url += (options.url.indexOf('?') = 0 ? '' : '?') + q; jquery.form.js (line 209) What version of the plugin are you using? I believe that is a bug that was fixed. And I believe that Diego is right in that you would only hit that bug if you had no action attribute on the form. Mike
[jQuery] Re: Adding div
I whipped up a quick demo. It's much easier when you give things classes to hang your hat on. http://commadot.com/jquery/toggleShow.php# Glen On Jan 15, 2008 7:53 AM, Michael [EMAIL PROTECTED] wrote: I have this code so far: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head script src=http://code.jquery.com/jquery-latest.js;/script script $(document).ready(function(){ $(document.body).click(function () { if ($(div:first).is(:hidden)) { $(div).slideDown(slow); } else { $(div).hide(); } }); }); /script style div{ background:#00; margin:3px; width:960px; height:40px; display:none; float:left; padding:15px 10px 0 0; text-align:right; } /style /head body ul lia href=#Search Site/a/li lia href=#Search Blog/a/li /ul div id=google_search !-- Google CSE Search Box Begins -- form action=http://www.google.com/cse; id=searchbox_015980814770052224501:fkp-cgqshuk input type=hidden name=cx value=015980814770052224501:fkp- cgqshuk / input type=text name=q size=25 / input type=submit name=sa value=Search / /form script type=text/javascript src= http://www.google.com/coop/cse/ brand?form=searchbox_015980814770052224501%3Afkp-cgqshuklang=en/ script !-- Google CSE Search Box Ends -- /div div id=blog_search !-- Wordpress blog search -- form name=input action=# method=get Search: input type=text name=user input type=submit value=Submit /form /div /body /html I need some help with the code. First: I want the code to display the div id=google_search when the user clicks on the 'Search Site link And div id=blog_search for when they press Search Blog, only displaying one at a time, not both at the same time. Second: When I click in the search fields the div disappears. How can I get rid of that so the user can enter a search into the box, but still have the ability to click anywhere on the body to make that div disappear. Kind Regards
[jQuery] lost process running after form submit with impromptu
Hi all, I'm using Impromptu to provide a simple confirm before submitting a form from within a greybox. Everything works great, but whenever the form is submitted (im not using ajax, ajah). Its like some lost process starts running in the parent window that spawned the greybox. Once I click any link it goes away, but it shouldnt be doing this. I am still on jquery 1.1.4 (yes I plan to update). Any ideas? simple submit $.prompt('Submit report',{ buttons: { Submit: 'yes', Cancel: 'no' }, callback: Submitform }) function Submitform() { var Choice = v; if (Choice == no) { alert(The form was not submitted.); } else { $(#ship_discr).get(0).submit(); } }
[jQuery] simple newbie js function problem...
script type=text/javascript $(document).ready(function(){ function force(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script if I click #joda I got the Error: force is not defined. hmmm. I have some basic misunderstanding here... THX in advance! cheers tlz
[jQuery] Re: [TABS plugin RELATED] Look mum, TABS layout only with CSS !!
Hi I Just had a quick look in Opera 9.25 and it is not working... Olivier Enrique Meléndez Estrada wrote: Looking at official TABs plugin, I realized that the HTML structure is not very natural. It uses a list (UL) of tab headers follow by tab bodies (DIV). Normally, what you get from your favorite CMS is something more like : a header (div, h,...), its body (div), another header (div, h, ...), its body (div), etc... My challenge was, using this last natural HTML structure, try to layout it in a TABs way. I think I've got it: http://www.ita.es/jquery/tabs_only_css.htm , where practically I have used the same HTML for all 8 TABS combinations. The result is compatible with IE6, IE7, FF and Opera. But there are some limitations to take into account when implementing as a Jquery plugin (as I wish, ;-): * Only versions topRight, topLeft, leftTop and rightTop are100% automatic (CSS doesn't depend on TABs number, height and width). * Versions leftBottom, rightBottom, bottomLeft and bottomRight depends on TABS number, and the height and/or width applied (This is very jquerysh-able) * I used QUIRK format (see doctype in HTML) for IE: the same CSS for IE6 and IE7, but in STRICT format it would only work in IE7 (I don't control IE6 by now) * Body TABs height is fixed (100px) and scroll appears where content doesn't fit. In case of non-liquid TABs, with fixed width, it could be possible to automatically calculate height for no-scroll body via jquery-script with 3 modes: * 1. height fixed: like now in the example. 2. height max: fixed to maximum no-scroll body TAB height. 3. height auto: calculating each no-scroll body TAB height. With all this, next steps would be: to search a little more for IE6 STRICT mode compatibility, and to create a Jquery plugin (with CSS dinamically generated?) Any suggestions, help, critics, comments, are very welcome. -- Enrique Meléndez Estrada (2367) Servicios Informáticos Organización y Servicios Internos Instituto Tecnológico de Aragón
[jQuery] Re: jQuery 1.1.2 Released: Happy 2nd Birthday!
Yes I agree thanks to the Jquery team for all their efforts. Jquery is awesome. Happy Bday Jquery Donation on its way. On Jan 14, 10:05 pm, John Resig [EMAIL PROTECTED] wrote: On the 2nd birthday of jQuery we're happy to bring you a new release of jQuery! Here's the announcement:http://jquery.com/blog/2008/01/15/jquery-122-2nd-birthday-present/ and here's the release notes:http://docs.jquery.com/Release:jQuery_1.2.2 Enjoy - and here's looking forward to another year of excellent jQuery code! --John
[jQuery] Re: simple newbie js function problem...
try with force function outside $...ready Feijó - Original Message - From: tlob [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, January 15, 2008 4:11 PM Subject: [jQuery] simple newbie js function problem... script type=text/javascript $(document).ready(function(){ function force(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script if I click #joda I got the Error: force is not defined. hmmm. I have some basic misunderstanding here... THX in advance! cheers tlz
[jQuery] Re: jQuery 1.2.2 Released: Happy 2nd Birthday!
Subject line says 1.1.2. Thought this was a parody post.. :) =P
[jQuery] Re: Validation Plugin - using required inside of addMethod
Tristan schrieb: Hi, I'm trying to create a new custom validation method similar to the other methods included in 'additional-methods.js'. I've created my method like this: jQuery.validator.addMethod('dateAfter', function(value, element, param) { var dVal = new Date(); var dParam = new Date(); dVal.setTime(Date.parse(value)); param.indexOf('#') -1 ? dParam.setTime(Date.parse(jQuery(param).val())) : dParam.setTime(Date.parse(param)); return !jQuery.validator.methods.required(value, element) || ((!/ Invalid|NaN/.test(dVal) !/Invalid|NaN/.test(dParam)) (dVal dParam)); }, 'End date cannot be before start date.'); When running this method, it errors out while executing jQuery.validator.methods.required(value, element). This is because jQuery.validator.methods.required executes this.depend(param, element) which is not available to the newly created method. Has anyone found a way around this while creating custom validation methods? Please take a look at how that check is implemented in the latest revision: http://dev.jquery.com/view/trunk/plugins/validate/additional-methods.js Basically all you need is return this.optional(element) || ..., though that won't work with the current release (1.1.2). 1.2 should be out really soon, and you can already check out the latest revision: http://dev.jquery.com/view/trunk/plugins/validate/ (lib/jquery.delegate.js is always required) Jörn
[jQuery] Re: simple newbie js function problem...
hm... why? can you explain me in detail why its not working that way? I like to learn. I uploaded it: http://www.lightwavers.net/dadda/ click joda, the icons should appear and start whirling around like this: http://www.ontoinfo.com/2006/09/22/javascript-flying-pictures-effect/ thx tl On Jan 15, 7:52 pm, Feijó [EMAIL PROTECTED] wrote: try with force function outside $...ready Feijó - Original Message - From: tlob [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, January 15, 2008 4:11 PM Subject: [jQuery] simple newbie js function problem... script type=text/javascript $(document).ready(function(){ function force(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script if I click #joda I got the Error: force is not defined. hmmm. I have some basic misunderstanding here... THX in advance! cheers tlz
[jQuery] Re: translating to jquery
Thank you.
[jQuery] How can I show/hide table row as it is a div?
I have tried $(#row1).show(slow) but it doesn't work. Is it possible to show and hide a table row as it is a div? Sebastian
[jQuery] Help with Tabs 3 and struts
Hi I'm programming a j2ee application, using struts. Yesterday I start learning jquery (really fast, helping me a lot!). now I'm trying to use Tabs3 , but i need that the context of the tab call an action first (using struts), and then charge the jsp, is it possible? thanks a lot!
[jQuery] Re: instant edit
just in case someone else wants it, I changed the event:'click',onblur:'cancel' to event:'click',onblur:'submit' so when you live the text input it submits. If empty, it will replace with click to submit - Original Message - From: Lionel Martelly [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Tuesday, January 15, 2008 11:54 AM Subject: [jQuery] Re: instant edit I just spent a tremendous amount of time trying to figure out what's wrong. I was supposed to hit enter instead of living the field. Is there a way to keep the value without having to do enter? e.g. by clicking outside of textbox? - Original Message - From: Lionel Martelly [EMAIL PROTECTED] To: jquery-en@googlegroups.com Sent: Monday, January 14, 2008 8:32 PM Subject: [jQuery] instant edit hi, Why is the instant edit not editing please? When I click on it it allows me to edit but the text does not update at all. Thanks ---$(function() { $(.click).editable(save.php?do=instant, { id: head_420, indicator : img src=images/spinner.gif', tooltip : click to edit, style : inherit }); });-b class=click id=head_420 style=display: inlineclick to edit/bif ($_REQUEST['do'] == 'instant') { $myvalue = $_REQUEST['value']; $head = $_REQUEST['head']; $arts = explode(_,$head); $artid = $articles[1];do db update here echo $myvalue; exit;
[jQuery] Re: Weird bahaviour of validation plugin in a textarea used by fckeditor
Hello, why not just try it out. For that I did a test page and the tutorial how to behave to see what I mean ... 1) insert sth into the textarea from fckeditor 2) click on submit button - the error occurs that you haven't entered at least 5 chars even though I/you have ... 3) focus the textarea and than again click the submit button - error goes away and it works as it should ... and no, I have no ajax submit! I dunno what's the problem ... it's weird :( thanks! Diego A. schrieb: You say the error occurs. What is the error? That's probably why people haven't replied to help. When you need help, it helps to be as clear and concise as possible. Anyway, I assume the problem is that you're trying to submit the contents of FCKEditor via ajax. This is not possible without explicitly updating the value of the textarea with the contents of the FCKEditor instance it points to. I think you need this: http://www.fyneworks.com/jquery/FCKEditor/ NOTE: the jQuery FCKEditor Plugin intercepts the ajaxSubmit function of the form plugin and explicitly updates the value of the textarea to be submitted. On Jan 15, 1:05 pm, KnoxBaby [EMAIL PROTECTED] wrote: Can anybody help me out? Thanks! On 7 Jan., 14:01, KnoxBaby [EMAIL PROTECTED] wrote: Hello, look at this page: http://www.jahlabs.de/jquery/test2/ I'm using validaiton plugin to validate the form, but there is the following weird behaviour: When I write something to the textbox and click on submit, the error occurs that I have to insert at least 5 characters (even though I have written more than this). Then I click in the textbox and without doin anything there, I click directly again the submit button and it works without any error message... What's wrong with it? thanks!
[jQuery] Re: Element by Name associative array
For anyone needing this, I had to play around with the name selector options and came up with this... $(input[name='name[key]']).val(); Swore I tried this earlier, but maybe I was delirious. On Jan 15, 9:51 am, Glen Lipka [EMAIL PROTECTED] wrote: By array key do you mean the nuber, the index in the array? You can view the actual jQuery object created with a selector using firebug or ms script editor. So for instance in firebug, you click on script on the left. Then add a new watch expression on the right. Put in $(input) and press enter. That will give you the whole array object from jQuery. I hope this is helpful, Glen On Jan 15, 2008 2:10 AM, Ryan [EMAIL PROTECTED] wrote: Hello all, I'm trying to get the value of an element by it's array key. input name='example[key]' / Any guidance would be appreciated. Thanks
[jQuery] navigating complex xml
Hi, I'm currently trying to use JQuery to navigate through OWL (type of xml) files, it works quite well but I do have a problem with traversing : for a fragment like this: rdfs:subClassOf owl:Restriction owl:onProperty rdf:resource=#hasColor / owl:cardinality rdf:datatype=xsd;nonNegativeInteger1/ owl:cardinality /owl:Restriction /rdfs:subClassOf the regular syntax seems to use the localName of the node (not namespaced) to fetch: $('subClassOf') gives results this goes completely wrong however when adding more complex selectors, basically child specifications nor attribute specifications seem to work, I'm currently handling it with xx.filter(function(){}) but if anyone knows a solution to the problem please let me know. What I've tried so far: $('subClassOf Restriction') no results $('subClassOf Restriction') no results $('subClassOf owl:Restriction') no results $('subClassOf owl\\:Restriction') no results etc. BUT $('subClassOf * ') gives me the results (array of restrictions) also $('onProperty') gives results but not: $('[EMAIL PROTECTED]') $('onProperty[resource]') etc etc any ideas? any help is appreciated.
[jQuery] Re: simple newbie js function problem...
The function 'force' belongs to the document.ready call, so as soon as that's done 'force' is destroyed. If you put it outside of the document.ready, the function exists globally for all javascript in the page. On Jan 16, 9:13 am, tlob [EMAIL PROTECTED] wrote: hm... why? can you explain me in detail why its not working that way? I like to learn. I uploaded it:http://www.lightwavers.net/dadda/ click joda, the icons should appear and start whirling around like this:http://www.ontoinfo.com/2006/09/22/javascript-flying-pictures-effect/ thx tl On Jan 15, 7:52 pm, Feijó [EMAIL PROTECTED] wrote: try with force function outside $...ready Feijó - Original Message - From: tlob [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, January 15, 2008 4:11 PM Subject: [jQuery] simple newbie js function problem... script type=text/javascript $(document).ready(function(){ function force(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script if I click #joda I got the Error: force is not defined. hmmm. I have some basic misunderstanding here... THX in advance! cheers tlz- Hide quoted text - - Show quoted text -
[jQuery] Re: Help with Tabs 3 and struts
On Jan 15, 7:39 pm, Diego [EMAIL PROTECTED] wrote: Hi I'm programming a j2ee application, using struts. Yesterday I start learning jquery (really fast, helping me a lot!). now I'm trying to use Tabs3 , but i need that the context of the tab call an action first (using struts), and then charge the jsp, is it possible? thanks a lot! I think I did not understand what you you need to do (that may also be because I don't know much about Struts). Can you explain again please? --Klaus
[jQuery] Re: navigating complex xml
sorry, I was not entirely correct: $('subClassOf Restriction') does give results, but the rest doesn't and I'd like to be more specific with the attributes.
[jQuery] ZOOM on the image
At this uRL http://demo.magentocommerce.com/sony-vaio-vgn-txn27n-b-11-1-notebook-pc-intel-core-solo-processor-u1500-2-gb-ram-100-gb-hard-drive-dvd-rw-drive-vista-business-charcoal-black.html i see a very strange js control for managing a zoom on the image build with scriptaculos. With jquery there is a plugin prebuild? Thank you Andrea AOSTA ITALY
[jQuery] Re: Help with Tabs 3 and struts
I am using jQuery with Struts 2, but do not understand your issue/ question... can you clarify? On Jan 15, 10:39 am, Diego [EMAIL PROTECTED] wrote: Hi I'm programming a j2ee application, using struts. Yesterday I start learning jquery (really fast, helping me a lot!). now I'm trying to use Tabs3 , but i need that the context of the tab call an action first (using struts), and then charge the jsp, is it possible? thanks a lot!
[jQuery] Re: Trying to set the id of a 2nd level div and failing
Use find()? The children() function (should) return unique immediate children which won't get you your second level divs in a single call from the #obj level, no matter what selector you use. eg... var obj = $(#obj); obj.find(.obj_level1.obj_level2).attr( id, Bob ); On Jan 15, 6:03 am, Mark Lacas [EMAIL PROTECTED] wrote: I'm trying to set the id of a 2nd level obj selected by class and it doesn't seem to work as I thought it would. Unfortunately all of the level one objects get the id assignment, not the level two object. Here it is before I do the operation: div id=obj div class=obj_level1 div class=obj_level2/div /div div class=obj_level1.1/div /div Then I do this: var obj = $(#obj); //bunch of code obj.children(.obj_level1 .obj_level2).attr( id, Bob ); It ends up like this: div id=obj div id=Bob class=obj_level1 div class=obj_level2/div /div div id=Bob class=obj_level1.1/div /div Note the two divs with the same id. . . Do I have to use: obj.children(.obj_level1).children(.obj_level2).attr( id, Bob ); Originally I was using: $(#obj .obj_level1 .obj_level2).attr( id, Bob ); And that worked ok, but I needed the object in a variable as I and using it repeatedly and didn't want to dereference it every time I use it, for speed's sake. Any thoughts as to the correct syntax to do this? Thanks, ml
[jQuery] Loading dynamic JS libraries with jQuery
Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... I thought I had this working before but now it's not. Here's my code: INDEX.HTML html head script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/global.js/script /head body /body /html GLOBAL.JS function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); // Creates the script element and appends it to the head $(document.createElement('script')) .attr('src', scriptsPath + scriptFile + .js) .attr('type', 'text/javascript') .appendTo('head'); } $(document).ready(function() { // Dynamically loads a list of javascript files loadJavascript('jquery.form'); } It should have created a script element like this: script type=text/javascript src=scripts/jquery.form.js/script And appended it to the head element, but it didn't work... I'm using the latest jQuery v1.2.2. Hope someone can clarify this to me... Why can't I do this?
[jQuery] Re: How can I show/hide table row as it is a div?
Hi, Sebastian... Yes, it is possible. I've worked trying to get smooth animation out of sliding table rows, but they're always jerky. I resorted to putting entire tables in div's and animating the div's to get smooth performance. What does your entire jQuery and HTML code look like? Got a page I can see? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Bober Sent: Tuesday, January 15, 2008 12:41 PM To: jQuery (English) Subject: [jQuery] How can I show/hide table row as it is a div? I have tried $(#row1).show(slow) but it doesn't work. Is it possible to show and hide a table row as it is a div? Sebastian
[jQuery] Re: Loading dynamic JS libraries with jQuery
Look at $.getScript: http://docs.jquery.com/Ajax/jQuery.getScript Try something like: $(document).ready(function() { $.getScript('script/jquery.form.js'); }); You can wrap $.getScript in your function to do the script path prepend and .js append. No need to do all the messy DOM stuff yourself. That's what jQuery is for. ;) Scott On Jan 15, 2008 6:20 PM, Nazgulled [EMAIL PROTECTED] wrote: Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... I thought I had this working before but now it's not. Here's my code: INDEX.HTML html head script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/global.js/script /head body /body /html GLOBAL.JS function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); // Creates the script element and appends it to the head $(document.createElement('script')) .attr('src', scriptsPath + scriptFile + .js) .attr('type', 'text/javascript') .appendTo('head'); } $(document).ready(function() { // Dynamically loads a list of javascript files loadJavascript('jquery.form'); } It should have created a script element like this: script type=text/javascript src=scripts/jquery.form.js/script And appended it to the head element, but it didn't work... I'm using the latest jQuery v1.2.2. Hope someone can clarify this to me... Why can't I do this? -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: how can a text field be hidden based on condition
var txt = $('theSelect :selected').text(); if(txt == 'cat' || txt.indexOf('c')==0 || ...test after test after test...){ $('selector_fieldToHide').hide(); } On Jan 15, 1:16 pm, Bhaarat Sharma [EMAIL PROTECTED] wrote: Thanks! but the values of this drop down box are dynamic and are coming from a DB. So I was wondering if jquery offers a method so that rather than doing '.val()' i could do something else so that I would get search on content of the option box rather than value. so for example option value=my_valcat/option So here i would like to see if the option contains 'cat' or starts with 'c' or something like that... Also, i know that jquery supports chained method but how does it work with logical operators like or || so in the example you have mentioned..what if i wanted to do a check for 'my value2' as well... I appreciate your help! On Jan 14, 8:39 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Something like below should work: if($('select[name=myDropdown] :selected').val() == 'my value'){ $('input[name=inputToBeHidden]').hide(); } On 1/14/08, Bhaarat Sharma [EMAIL PROTECTED] wrote: Hello, I'm a little new to jQuery. Is it possible to hide/disable a text field based on a certain value in a drop down box on the same page?? I'd appreciate if someone could either show me a similar example or guide a little. Thanks -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjam...
[jQuery] Re: Loading dynamic JS libraries with jQuery
I replaced the function with this: function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); $.getScript(scriptsPath + scriptFile + .js); } But it still doesn't work... On Jan 15, 11:29 pm, Scott Trudeau [EMAIL PROTECTED] wrote: Look at $.getScript: http://docs.jquery.com/Ajax/jQuery.getScript Try something like: $(document).ready(function() { $.getScript('script/jquery.form.js'); }); You can wrap $.getScript in your function to do the script path prepend and .js append. No need to do all the messy DOM stuff yourself. That's what jQuery is for. ;) Scott On Jan 15, 2008 6:20 PM, Nazgulled [EMAIL PROTECTED] wrote: Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... I thought I had this working before but now it's not. Here's my code: INDEX.HTML html head script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/global.js/script /head body /body /html GLOBAL.JS function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); // Creates the script element and appends it to the head $(document.createElement('script')) .attr('src', scriptsPath + scriptFile + .js) .attr('type', 'text/javascript') .appendTo('head'); } $(document).ready(function() { // Dynamically loads a list of javascript files loadJavascript('jquery.form'); } It should have created a script element like this: script type=text/javascript src=scripts/jquery.form.js/script And appended it to the head element, but it didn't work... I'm using the latest jQuery v1.2.2. Hope someone can clarify this to me... Why can't I do this? -- -- Scott Trudeau scott.trudeau AT gmail DOT comhttp://sstrudeau.com/ AIM: sodthestreets
[jQuery] How to have Autocomplete dropdown act like select box and trigger onchange event for input
I am trying to replace a previous bit of html that managed input by both an input and a select box. I now want to work with a single input field using jquery.autocomplete.js, but I have not been able to get autocomplete to use the onchange JavaScript code used by that previous bit of html. I have gotten autocomplete to display and select all the values correctly in multiple analogous fields on the same form, but I do not know how to have it trigger the code that was previously run under an onchange event. Unfortunately, I do not understand much of the jquery and autocomplete code, and I am only moderately more familiar with JavaScript. Here is a bit of the current relevant code: input class=text id=city%=addID% type=text name=city%=addID% size=30 maxlength=120 value=c:out value=$ {partyAddress.city}/ onchange=javascript: updatePartyAddress(this, %=addID%); ... var idList = %=addIDStringBuffer.toString()%; // This is a list comprising a unique identifier, the addID (see html input box above), for each address on the page. var idArray = idList.split(,); $(document).ready(function() { for(var i=0; i idArray.length; i++) { $(#city+idArray[i]).autocompleteArray( [ %=cityList.toString()% ], { delay:10, autoFill:true, max:10 } ); } }); As I am very much a newbie to JavaScript and its plugins, any simple, or more complex but step-by-step, help would be greatly appreciated. Mark R. Thompson
[jQuery] Re: simple newbie js function problem...
Just to elaborate (because it tripped me up when I start out too and other js noobs like me might find it useful): In your example, function force is a function within the document.ready function: $(document).ready( function(){// Function called when document.ready fires function force(){ // Function belonging to document.ready event doStuffHere...} } ); Remember that variables declared within functions only exist for that function. If you ran the code below, the message box would return undefined: script function someFunction() { var someVar = hi; } someFunction(); alert(someVar); /script The key is to remember that document.ready calls a function - it isn't just free javascript that executes in-line like the alert call above. What you can do to make the funciton global, is to declare the variable outside of the function, and assign it later. For example, for a variable we can modify the earlier script: script var someVar; function someFunction() { someVar = hi; } someFunction(); alert(someVar); /script This will return hi because the 'someVar' function is scoped outside of the function someFunction. In the same way, you can modify your script to the following, and it shoud work: script type=text/javascript var force; $(document).ready(function(){ force = function(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script Now the variable 'force' is global, the function will stick after document.ready has completed and your code should work. Hope this helps everyone out with other scoping issues :D On Jan 16, 9:56 am, Hamish Campbell [EMAIL PROTECTED] wrote: The function 'force' belongs to the document.ready call, so as soon as that's done 'force' is destroyed. If you put it outside of the document.ready, the function exists globally for all javascript in the page. On Jan 16, 9:13 am, tlob [EMAIL PROTECTED] wrote: hm... why? can you explain me in detail why its not working that way? I like to learn. I uploaded it:http://www.lightwavers.net/dadda/ click joda, the icons should appear and start whirling around like this:http://www.ontoinfo.com/2006/09/22/javascript-flying-pictures-effect/ thx tl On Jan 15, 7:52 pm, Feijó [EMAIL PROTECTED] wrote: try with force function outside $...ready Feijó - Original Message - From: tlob [EMAIL PROTECTED] To: jQuery (English) jquery-en@googlegroups.com Sent: Tuesday, January 15, 2008 4:11 PM Subject: [jQuery] simple newbie js function problem... script type=text/javascript $(document).ready(function(){ function force(){ doStuffHere...} $('#joda').click(function () { $('img').show(); setInterval('force()',500); }); }); /script if I click #joda I got the Error: force is not defined. hmmm. I have some basic misunderstanding here... THX in advance! cheers tlz- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Loading dynamic JS libraries with jQuery
.getScript()? On Jan 15, 2008 3:20 PM, Nazgulled [EMAIL PROTECTED] wrote: Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... I thought I had this working before but now it's not. Here's my code: INDEX.HTML html head script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/global.js/script /head body /body /html GLOBAL.JS function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); // Creates the script element and appends it to the head $(document.createElement('script')) .attr('src', scriptsPath + scriptFile + .js) .attr('type', 'text/javascript') .appendTo('head'); } $(document).ready(function() { // Dynamically loads a list of javascript files loadJavascript('jquery.form'); } It should have created a script element like this: script type=text/javascript src=scripts/jquery.form.js/script And appended it to the head element, but it didn't work... I'm using the latest jQuery v1.2.2. Hope someone can clarify this to me... Why can't I do this? -- http://morglog.alleycatracing.com Lets make up more accronyms! http://www.alleycatracing.com LTABOTIIOFR! ROFL! ROFL! ROFL! Upcoming alley cats, reviews, touring logs, and a general congregation of bike nerdity.
[jQuery] Re: Loading dynamic JS libraries with jQuery
On Jan 16, 2008 12:20 AM, Nazgulled [EMAIL PROTECTED] wrote: Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... AFAIK browsers do not support loading external JS after the DOM has loaded. I think this is the reason for the $.getScript(script.js, function(){ do stuff... }); function. I use this in my projects and it works great and is a much cleaner alternative. You could even bind it to an event so it only get's loaded after the event is triggered (very cool). -- Jeroen
[jQuery] Superfish without hoverIntent
I'm using clueTip and Superfish. The only problem is that I need hoverIntent for clueTip to do what I intend, but it makes the menus lag ever so slightly. Without the hoverintent plugin, Superfish seems to be just fine. So, what I need is some way to disable Superfish's use of hoverIntent (keeping hoverIntent only for use by clueTip). I presume I'd have to hack something out of Superfish, but I just don't know what. Thanks, Alex
[jQuery] Re: Superfish without hoverIntent
Hi Alex Have you tried just having the script for Hover Intent below superfish in your source code. That way superfish wont have access to hoverintent due to it not being loaded prior to superfish being read by the browser. Cheers Stephen
[jQuery] Re: Superfish without hoverIntent
Hi Alex, Usually hoverIntent improves how Superfish works as the very slight lag means that submenus are not flickering open unnecessarily, so I assume you may have altered the settings so that the delay is longer for use with Cluetip. To hack Superfish, change the applySuperfishHovers function to this: applySuperfishHovers : function(){ return this.hover(over,out); } Just so you are aware, in a soon-to-be released update to Superfish, that function doesn't exist, so maybe I'll add an official option to be able to disable hoverIntent for the menu. Cheers Joel Birch.
[jQuery] Re: Superfish without hoverIntent
Thanks Stephen, that's a much better idea! Joel Birch.
[jQuery] Re: Superfish without hoverIntent
On 16/01/2008, Joel Birch [EMAIL PROTECTED] wrote: Thanks Stephen, that's a much better idea! Joel Birch. ...Although I should mention that this won't work with the *next* version of Superfish (v1.4) as it detects hoverIntent regardless of where it appears in the source order. Instead, there will be an option called disableHI that you can set to true. Joel Birch.