[jQuery] Re: [validate] Hooks for animating the appearance and disappearance of the error messages
Hi Kelvin, using errorPlacement is a really bad workaround, as its called only once per error. After using errorPlacement to add the error-label to the DOM, it isn't called again. A better workaround would use the highlight and unhighlight options. Could you provide a simple demo that shows the behaviour you'd like to achieve? Just some jQuery code that animates some label, with the necessary markup and CSS. That would be a good starting point for me to work on a solution. Jörn On Tue, Feb 17, 2009 at 11:32 PM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi, I've just used the validate plugin for the first time and it works great :) One extra thing I would love to see is some sort of hooks which allow the user to customise how the error messages appear and disappear. I managed to hack it in for appearing messages using the errorPlacement function but I couldn't find a way to animate the disappearing error messages. More information, an example and some code here: http://www.kelvinluck.com/2009/02/progressive-enhancement-with-jquery-example/ Would this be something you would consider adding into the plugin? Thanks, Kelvin :) p.s. sorry if this has already been discussed - I haven't been able to keep up with the volume on this list for a looong time! p.p.s. sorry if this comes through twice - I sent it from the wrong email address first time...
[jQuery] Re: [validate] validate form fields with php via ajax
Yes, using the remote method: http://docs.jquery.com/Plugins/Validation/Methods/remote Jörn On Tue, Feb 17, 2009 at 8:13 PM, id404 ttarp...@googlemail.com wrote: this question is about the jquery validation plugin (http:// bassistance.de/jquery-plugins/jquery-plugin-validation/) i have some input fields in which users can enter URLs. i wrote a php script which checks the content of these URLs and returns boolean values depending of the content. is there a possibility to let the jquery validation-plugin use this php script to check if the input is valid?
[jQuery] Re: [validate] ValidationGroup functionality
Okay, in this case, the groups-option doesn't help. You could try the variations of the required method: http://docs.jquery.com/Plugins/Validation/Methods/required Or follow the login-form example here, implementing similar functionality to the forgot-password-link: http://jquery.bassistance.de/validate/demo/login/ Jörn On Wed, Feb 18, 2009 at 6:53 AM, Paresh paresh.m.jaga...@gmail.com wrote: Thank you Jörn for the reply. a bit modified code to show what exactly needed... Here I have added a new 2 textboxes and a button now the requirement ( as ASP.NET does) is when Submit Name button is pressed then only the group username should be validated and if both the textboxes of the group username are filled (AND the address textboxes are EMPTY) the form should be submitted. In normal HTML this can be done using the different forms but in ASP.NET there is only one FORM that is runat server that encapsulates other server controls. !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 type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script $(document).ready(function(){ $(#myform).validate({ groups: { username: fname lname, address: address1 phone }, errorPlacement: function(error, element) { if (element.attr(name) == fname || element.attr(name) == lname ) error.insertAfter(#lastname); else error.insertAfter(element); }, debug:true }) }); /script /head body form id=myform labelYour Name/label input name=fname class=required value=Pete / input name=lname id=lastname class=required / input name=address1 class=required / input name=phone id=lastname class=required / br/ input type=submit value=Submit Name/ input type=submit value=Submit Address/ /form /body /html On Feb 17, 6:48 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: There is the group-option. Seehttp://docs.jquery.com/Plugins/Validation/validatefor details. Specify grouping of error messages. A group consists of an arbitrary group name as the key and a space separated list of element names as the value. Use errorPlacement to control where the group message is placed. Use a table layout for the form, placing error messags in the next cell after the input. !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 type=text/javascript src=http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js;/script script $(document).ready(function(){ $(#myform).validate({ groups: { username: fname lname }, errorPlacement: function(error, element) { if (element.attr(name) == fname || element.attr(name) == lname ) error.insertAfter(#lastname); else error.insertAfter(element); }, debug:true }) }); /script /head body form id=myform labelYour Name/label input name=fname class=required value=Pete / input name=lname id=lastname class=required / br/ input type=submit value=Submit/ /form /body /html Jörn On Tue, Feb 17, 2009 at 11:09 AM, Paresh paresh.m.jaga...@gmail.com wrote: Greetings, is there anyway to have the validationGroup kind of functionality that is in the ASP.NET validation? because there are no multiple forms and validation on set of controls required based on the similar grouping? Like a set of controls share a similar group and then on click of a button the validationGroup is set into the jQuery validator options and then in the validation only those controls are validated which have that specific validationGroup like rules: { TextBox1: 'required', TextBox2: 'required' TextBox3: 'required', TextBox4: 'required' }, messages: { TextBox1: 'Please enter the name.', TextBox2: 'Please enter last name.' TextBox3: 'Please enter address.', TextBox4: 'Please enter phone number.' }, validationGroups: { group1:{TextBox1,TextBox2} group2:{TextBox3,TextBox4} } input type submit onclick=validator.validationGroup='group1' text='Fill Primary information' input type submit onclick=validator.validationGroup='group2' text='Fill contact information' or something similar?
[jQuery] Re: jQuery validation question: validating multiple email inputs
Hi, Taking a second look on your code it's clear why only the first email address is validated: you have a return statement in your for loop. try something like: email: function(value, element) { if (this.optional(element)) // return true on optional element (whatever this is for?) return true; var emails = value.split(,); var valid = (value.length 0); // make sure that value is not empty for(var emailAddress in emails) { valid = valid /.../i.test(emailAddress); // logical and of all email validations } return valid; } by(e) Stephan 2009/2/17 roryreiff roryre...@gmail.com: Yeah, I actually have that fixed in the posted link, but thanks for pointing that out. So, something else is at error now. On Feb 17, 9:04 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi is this just a copy paste error, or a real syntax error? You have to quote the comma in your split command: var emails = value.split(,); by(e) Stephan 2009/2/17roryreiffroryre...@gmail.com: So far, I have adapted this: email: function(value, element) { return this.optional(element) || /^((([a-z]|\d|[!#\$%'\*\+\-\/=\? \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\ $%'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+) *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900- \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)? (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a- z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~| [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a- z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]| [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); }, into this: email: function(value, element) { var emails = value.split(,); for(var emailAddress in emails) { return this.optional(element) || /^((([a-z]|\d|[!#\$%'\*\+\-\/=\? \^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\ $%'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+) *)|((\x22)\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c \x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF \uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900- \uFDCF\uFDF0-\uFFEF]*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)? (\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a- z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~| [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF \uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF \uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a- z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]| [\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(emailAddress); } }, any thoughts why this is not working? Thanks, On Feb 13, 11:10 am, Ed Lerner emle...@gmail.com wrote: I'm new to jQuery as well. In other languages, you would take the string that holds all of the emails and do a 'split' on commas. This should give you an array where each element is an individual email. From there, just validate each element. How to do this in jQuery, someone more experienced than I may be able to help with. On Feb 13, 11:28 am,roryreiffroryre...@gmail.com wrote: Hi there, I am using the Validation plugin to validate a form that emails the current pages URL to the recipients entered in to the email to field. I want to validate that field for multiple emails addressed separated by commas...and ideas on how to do this? I'm a bit new to jQuery so I am a little confused how to approach this. I was thinking somehow altering the email function so that is parses the input and does a for each on every email address. Is this correct thinking? Is there an easier way to do this? Thanks,
[jQuery] Re: [validate] Hooks for animating the appearance and disappearance of the error messages
Hi Jörn, Thanks for the reply :) I know using the errorPlacement is a bad workaround but I couldn't figure out another way to do it. Basically what I would like is for each error to slideDown when it is shown and to slideUp when it is hidden. When I looked through the code, it seemed like highlight and unhighlight were passed a reference to the actual field which was invalid (rather than it's associated error message) so I wasn't sure I could use those... My idea was that rather than calling hide() and show() on the error messages directly you could instead have settings which would by default point to those functions but which the user could override. Does that make sense? Cheers, Kelvin :) On Wed, Feb 18, 2009 at 12:30 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi Kelvin, using errorPlacement is a really bad workaround, as its called only once per error. After using errorPlacement to add the error-label to the DOM, it isn't called again. A better workaround would use the highlight and unhighlight options. Could you provide a simple demo that shows the behaviour you'd like to achieve? Just some jQuery code that animates some label, with the necessary markup and CSS. That would be a good starting point for me to work on a solution. Jörn On Tue, Feb 17, 2009 at 11:32 PM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi, I've just used the validate plugin for the first time and it works great :) One extra thing I would love to see is some sort of hooks which allow the user to customise how the error messages appear and disappear. I managed to hack it in for appearing messages using the errorPlacement function but I couldn't find a way to animate the disappearing error messages. More information, an example and some code here: http://www.kelvinluck.com/2009/02/progressive-enhancement-with-jquery-example/ Would this be something you would consider adding into the plugin? Thanks, Kelvin :) p.s. sorry if this has already been discussed - I haven't been able to keep up with the volume on this list for a looong time! p.p.s. sorry if this comes through twice - I sent it from the wrong email address first time...
[jQuery] Re: Exploding nested divs....
Hi, how do you explode the outer div? Can you share your function with us? by(e) Stephan 2009/2/18 Ricardo Tomasi ricardob...@gmail.com: What do you mean by explode? remove? On Feb 17, 4:50 pm, webspee...@gmail.com webspee...@gmail.com wrote: Hey all. Exploding a simple div is easy enough, but can you explode nested divs? I have a div container and inside it I have content generated from an AJAX call. When I explode the outer div, I don't get the pieces and the screen freezes up for a second. I don't know if the div is too large or if it is because of the inside div. Also, I would assume the inside div (the one returned via AJAX) would have to be re-binded, is this correct? If so, how do you bind on an explode? I can't simply write the statement, otherwise it would explode immediately on the return from the AJAX call. I was just curious about this is all. ...
[jQuery] Re: [validate] Hooks for animating the appearance and disappearance of the error messages
Yes, it does. And for implementing, it would help a lot to have a simple demo that has the right layout for the animations to work. Jörn On Wed, Feb 18, 2009 at 9:40 AM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi Jörn, Thanks for the reply :) I know using the errorPlacement is a bad workaround but I couldn't figure out another way to do it. Basically what I would like is for each error to slideDown when it is shown and to slideUp when it is hidden. When I looked through the code, it seemed like highlight and unhighlight were passed a reference to the actual field which was invalid (rather than it's associated error message) so I wasn't sure I could use those... My idea was that rather than calling hide() and show() on the error messages directly you could instead have settings which would by default point to those functions but which the user could override. Does that make sense? Cheers, Kelvin :) On Wed, Feb 18, 2009 at 12:30 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi Kelvin, using errorPlacement is a really bad workaround, as its called only once per error. After using errorPlacement to add the error-label to the DOM, it isn't called again. A better workaround would use the highlight and unhighlight options. Could you provide a simple demo that shows the behaviour you'd like to achieve? Just some jQuery code that animates some label, with the necessary markup and CSS. That would be a good starting point for me to work on a solution. Jörn On Tue, Feb 17, 2009 at 11:32 PM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi, I've just used the validate plugin for the first time and it works great :) One extra thing I would love to see is some sort of hooks which allow the user to customise how the error messages appear and disappear. I managed to hack it in for appearing messages using the errorPlacement function but I couldn't find a way to animate the disappearing error messages. More information, an example and some code here: http://www.kelvinluck.com/2009/02/progressive-enhancement-with-jquery-example/ Would this be something you would consider adding into the plugin? Thanks, Kelvin :) p.s. sorry if this has already been discussed - I haven't been able to keep up with the volume on this list for a looong time! p.p.s. sorry if this comes through twice - I sent it from the wrong email address first time...
[jQuery] Re: [validate] Hooks for animating the appearance and disappearance of the error messages
Hi, Does this help? http://www.kelvinluck.com/assets/jquery/validate/validate.html It's a simplified version of the original demo ( http://www.shair.it/sandbox ) - but it is still using errorPlacement to slideDown the error messages first time they appear, Here is another version which (I think) would work with my imagined enhancement: http://www.kelvinluck.com/assets/jquery/validate/validate2.html Let me know if you need something different, Cheers, Kelvin :) On Wed, Feb 18, 2009 at 12:58 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Yes, it does. And for implementing, it would help a lot to have a simple demo that has the right layout for the animations to work. Jörn On Wed, Feb 18, 2009 at 9:40 AM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi Jörn, Thanks for the reply :) I know using the errorPlacement is a bad workaround but I couldn't figure out another way to do it. Basically what I would like is for each error to slideDown when it is shown and to slideUp when it is hidden. When I looked through the code, it seemed like highlight and unhighlight were passed a reference to the actual field which was invalid (rather than it's associated error message) so I wasn't sure I could use those... My idea was that rather than calling hide() and show() on the error messages directly you could instead have settings which would by default point to those functions but which the user could override. Does that make sense? Cheers, Kelvin :) On Wed, Feb 18, 2009 at 12:30 AM, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Hi Kelvin, using errorPlacement is a really bad workaround, as its called only once per error. After using errorPlacement to add the error-label to the DOM, it isn't called again. A better workaround would use the highlight and unhighlight options. Could you provide a simple demo that shows the behaviour you'd like to achieve? Just some jQuery code that animates some label, with the necessary markup and CSS. That would be a good starting point for me to work on a solution. Jörn On Tue, Feb 17, 2009 at 11:32 PM, Kelvin Luck kelvin.l...@gmail.com wrote: Hi, I've just used the validate plugin for the first time and it works great :) One extra thing I would love to see is some sort of hooks which allow the user to customise how the error messages appear and disappear. I managed to hack it in for appearing messages using the errorPlacement function but I couldn't find a way to animate the disappearing error messages. More information, an example and some code here: http://www.kelvinluck.com/2009/02/progressive-enhancement-with-jquery-example/ Would this be something you would consider adding into the plugin? Thanks, Kelvin :) p.s. sorry if this has already been discussed - I haven't been able to keep up with the volume on this list for a looong time! p.p.s. sorry if this comes through twice - I sent it from the wrong email address first time...
[jQuery] Traversing
The following HTML is inside a loop, so it can be repeated many times over. table width=600 border=0 cellspacing=0 cellpadding=0 tr tdtable class=atrtd/td/tr/table/td td rowspan='2'nbsp;/td /tr tr tdtable class=btrtd/td/tr/table/td /tr /table I have a click function on table.a All table.b are given hide() How do I show() only the table.b that directly follows the table.a that has been clicked? I have been trying something like: $(table.a).click(function(){ $(this). From here I dont know whether to do parent() or next() or how to move across the tr and td to table.b
[jQuery] Re: the jquery form plugin and the accents !
Really no ideas ? On 15 fév, 18:10, phicarre gam...@bluewin.ch wrote: I have a problem with the jquery form plugin. I submit a form (to test.php) in which there are text fields and one file field + enctype='multipart/form-data'. The html page has a meta which defines the charset to iso 8859-1 The test.php module begin with header('content-type:text/ html;charset=iso-8859-1'); I read the text fields like this: $nom = htmlspecialchars(addslashes ($_POST['nom'])); I read the upload file like this: $tmp_name = $_FILES['photo'] ['tmp_name']; Here is the problem: If my text fields contain accents and the file field is empty then $name is correct. If my text fields contain accents and the file field is NOT empty then $name is NOT correct. example: René gives Ren? I don't understand the impact of the $_FILES on $_POST. Does the jquery plugin changes the charset ?
[jQuery] Picasa getJSON not working properly
I'm trying to pull my Picasa album JSON feed into my website, but I'm having problems. It is pulling in the Picasa thumbnails without a problem, but when I try to pull in the full sized photos (200kb), it returns nothing, even though I have verified that the links are valid. Below is the code that I'm using on this skeleton webpage - http://derekperkins.com/seatability/wp-content/themes/Seatability/test.html. Why would the thumbnails work but not the full content? $j = jQuery.noConflict(); $j(document).ready(function(){ $j.getJSON(http://picasaweb.google.com/data/feed/api/user/ Seatability/albumid/5301645629882336001/? kind=photoaccess=publicalt=jsoncallback=?, function(data){ var picsCount = data.feed.entry.length; for (var i = 0; i picsCount; i++) { var pic = data.feed.entry[i]; $j('body').append('p Thumb - ' + pic.media$group.media $thumbnail[0].url + '/p'); $j('body').append('p Full - ' + pic.media$group.media$content [0].url + '/p'); $j(img/).attr(src, pic.media$group.media$thumbnail [0].url).attr(alt, pic.summary.$t).appendTo(#thumbs); $j(img/).attr(src, pic.media$group.media $content[0].url).attr(alt, pic.summary.$t).appendTo (#pics); } }); });
[jQuery] Re: Initialize tabs href.
I tried to put the links in the tabs definition blank as described here: http://pastie.org/392713 Then I tried to initialize them in the document.ready (because I have to pass 1 parameter to the url that i'm calling); When i create the tabs via jQuery the first tab is not selected (it is selected the second one), and the tab number is 2 instead of 3. It seems that the first tab is not considered. Any idea? Kind regards Massimo Ugues http://pastie.org/392747 On Feb 10, 3:54 am, Richard D. Worth rdwo...@gmail.com wrote: You need to init the tabs on the element before you can call the .tabs('ur'... method. Untested: http://pastie.org/384667 - Richard On Mon, Feb 9, 2009 at 2:46 PM, m.ugues m.ug...@gmail.com wrote: Hallo all. I would like to initialize the tabs href on the document.ready. http://pastie.org/384170 I tried like this http://pastie.org/384232 But it doesn't work. Any idea? Kind regards Massimo Ugues
[jQuery] Re: Initialize tabs href.
Could you share a complete code sample, full html and javascript in one pastie? Thanks. - Richard On Wed, Feb 18, 2009 at 6:42 AM, m.ugues m.ug...@gmail.com wrote: I tried to put the links in the tabs definition blank as described here: http://pastie.org/392713 Then I tried to initialize them in the document.ready (because I have to pass 1 parameter to the url that i'm calling); When i create the tabs via jQuery the first tab is not selected (it is selected the second one), and the tab number is 2 instead of 3. It seems that the first tab is not considered. Any idea? Kind regards Massimo Ugues http://pastie.org/392747 On Feb 10, 3:54 am, Richard D. Worth rdwo...@gmail.com wrote: You need to init the tabs on the element before you can call the .tabs('ur'... method. Untested: http://pastie.org/384667 - Richard On Mon, Feb 9, 2009 at 2:46 PM, m.ugues m.ug...@gmail.com wrote: Hallo all. I would like to initialize the tabs href on the document.ready. http://pastie.org/384170 I tried like this http://pastie.org/384232 But it doesn't work. Any idea? Kind regards Massimo Ugues
[jQuery] cannot call twice: $(#foo).mywidget()
I created a widget and figured that it can only be called once per element: $.widget('ui.mywidget', { _init: function() { alert('hello'); } } $.widget(ui.mywidget, mywidget); $(#foo).mywidget(); // alerts hello $(#foo).mywidget(); // doesn't do anything now I understand this is by design because _init acts like a static constructor. however, I want to create a widget to add a panel to #foo each time it's called so: $(#foo).addpanel(); $(#foo).addpanel(); But that obvioulsy fails.What's the work around or what is a better design? I don't want to do: $(#foo).addpanel(); $(#foo).addpanel(add); $(#foo).addpanel(add); because that requires an extra () call followed by (add), (add). -- Aleem
[jQuery] Re: Help validating dynamic form elements
i suppose the 13 boxes' IDs are generated in order,so go through all the boxes by id: var pass=0; for(var i=1;i=13;i++){ if($(#mybox+i).val() != ') pass+=1; } if(pass=0) return false; and then, put your code in a function and bind it to the submit event of your form. (i'm also a starter) 2009/2/18 netcomp ra...@netcompulsion.com Hello, I'm a bit new to jQuery. I have a dynamic form which could contain any number of input boxes (from 1 to 13) named attrib1 thru attrib13. I need to ensure at least one of the input boxes gets filled in - there again it can be any of the generated boxes. Don't suppose someone can help get me started? TIA
[jQuery] Re: Using jQuery.noConflict() with Prototype/Scriptaculous
I am also having difficulties trying to get jQuery working with prototype/Scriptaculous. I am trying to combine a jQuery Lightbox plug-in with a prototype/ Scriptaculous Carousel plug-in. I have added the jQuery.noConflict() process but to no avail. The lightbox process works but the carousel doesn't. Hope some one can assist: Here is a sample of my code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head script src=Resources/jquery.js language=JavaScript type=text/ javascript/script script src=Resources/jquery.lightbox-0.5.js language=JavaScript type=text/javascript/script script src=Resources/prototype1602packer.js type=text/javascript charset=utf-8/script script src=Resources/scriptaculous181packer.js type=text/ javascript charset=utf-8/script script src=Resources/glider.js type=text/javascript charset=utf-8/script link rel=stylesheet type=text/css href=css/ jquery.lightbox-0.5.css media=screen / script type=text/javascript var $j = jQuery.noConflict(); $j(document).ready(function() { $j('#gallery a').lightBox(); }); /script style type=text/css /* jQuery lightBox plugin - Gallery style */ #gallery { background-color: #444; padding: 20px; width: 94%; } #gallery ul { list-style: none; } #gallery ul li { display: inline; } #gallery ul img { border: 5px solid #3e3e3e; border-width: 5px 5px 20px; } #gallery ul a:hover img { border: 5px solid #fff; border-width: 5px 5px 20px; color: #fff; } #gallery ul a:hover { color: #fff; } /style ... .. script type=text/javascript//![CDATA[ document.observe('dom:loaded',function(){ var select = (window.location.href.indexOf('?') -1) ? window.location.href.split('?')[1] : ''; var my_glider = new Glider(item2_wrap, {duration:0.5, autoGlide:true, frequency:2, initialSection: select}); $(item2_wrap).getElementsBySelector('.glider.next').each(function (elm){ elm.observe('click',function(evt){ Event.stop(evt); return my_glider.next(); }); }); $(item2_wrap).getElementsBySelector('.glider.previous').each (function(elm){ elm.observe('click',function(evt){ Event.stop(evt); return my_glider.previous(); }); }); }); //]]/script /head body div id=PageDiv style=position:relative; margin:auto; width:850px; height:100% div id=hdrScreenShots style=position:absolute; left:0px; top:0px; width:850px; height:63px; z-index:1 a name=topimg src=Resources/hdrscreenshots.gif border=0 width=850 height=63 alt=screen shots style=float:left /a/div div id=hdrLine style=position:absolute; left:0px; top:71px; width: 850px; height:1px; z-index:2 img src=Resources/index5d.gif border=0 width=850 height=1 alt= style=float:left /div div id=item2_wrapdiv id=item2div class=scrollerdiv class=content div id=galleryContainer class=sectiondiv style=position:relative; width:719px; height:594px; background- color:#fff; overflow:visible div id=item1 style=position:absolute; left:5.19px; top:5px; width:710px; height:589px; z-index:1 div id=gallery ul li a href=photos/image1.jpg title=screen shot 1 img src=photos/thumb_image1.jpg width=72 height=72 alt= / ... . /ul /div/div /div/div div id=galleryContainer1 class=sectiondiv style=position:relative; width:719px; height:594px; background- color:#fff; overflow:visible div id=item1a style=position:absolute; left:5.19px; top:5px; width:710px; height:589px; z-index:1 div id=gallery ul li a href=photos/image1.jpg title=screen shot 1 img src=photos/thumb_image1.jpg width=72 height=72 alt= / /a /li etc On Jan 7, 6:55 pm, seasoup seas...@gmail.com wrote: noConflict was designed specifically with prototype in mind :) The easiest way to do both jQuery and proto is to do: var $j = jQuery.noConflict(); and use $j instead of $ for jQuery. $j('#id'), for example. On Jan 6, 10:23 pm, Magnificent imightbewrongbutidontthin...@gmail.com wrote: Hi Erik, thanks for the reply. I've been messing with things and I tried replacing my calls to local versions of prototype/scriptaculous to use google: script src=http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/ prototype.js type=text/javascript/script script src=http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/ scriptaculous.js type=text/javascript/script And it seems to be working
[jQuery] Re: field (min, max) depending on other field value
You can use jquery.validator (http://bassistance.de/jquery-plugins/ jquery-plugin-validation/) with a custom validation method on the age field. Here's an example: //custom validation method $.validator.addMethod(contextualAgeValidation, function(value, element, params) { //see if the first category is selected if( $(#category).val() == 1 ){ //if so, return true if the age is 30 or more, false if not return value = 30; } return true; }, Age must be at least 30 if the first category is selected); Good luck! On Feb 15, 2:29 pm, petergab adm...@o2.pl wrote: 1. I have a form and two fields. One is category and one is age. If first category is selected the age must be min 30. Is it possible to validate it with jQuery? 2. Second one is similar. I need to set the earliest date in the field depending on category. -- View this message in context:http://www.nabble.com/field-%28min%2C-max%29-depending-on-other-field... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] A question for John Resig
This might be a stupid question, but I have to ask ... What is the reason for not having functions like isString, isNumber, isBoolean, etc? Is it just because that would create extra function calls?
[jQuery] Checkboxes enabled/disable button
Hello Guys, Fairly noobish here so hoping to learn a little something from this challenge. I have a form which contains a bunch of different checkboxes (all the same name) and a bunch of different button elements. I want to by default have these buttons disabled unless at least one checkbox is checked, if no checkboxes are checked then they need to be disabled. input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / button type=buttonClick me to do something/button button type=buttonClick me to do something else/button button type=buttonClick me to do something cool/button button type=buttonClick me to do nothing/button If this were just a single checkbox then I could figure this out without too much hassle but I'm unsure as to how I should be checking is any of the boxes are checked, presumably we can do some sort of array count for instances of it or something? who knows? I'd appreciate your thoughts on this guys. Robert
[jQuery] Extending a plugin
Hi, I might have used the wrong terminology here so I will explain what I want to do. I am currently using the jquery.form plugin to make my forms 'ajaxable' where needed. However, I would like to add some extra functionality to the plugin which is specific to my application. In this circumstance is it better to write the functionality into the plugin directly or 'extend' it somehow? I say 'extend' when all I really need is to add some functions. Some forms won't need this extra functionality so extending it seems to me, to be the way forward. Would I use extend() to do this or is there some other syntactic sugar I can use? Sources: http://docs.jquery.com/Plugins/Authoring
[jQuery] clueTip call from javascript
Hello All, I need to implement this functionality using clueTip (great Karl for the plugin) Using OpenLayers if a user clicks on a point: OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {** }, trigger: function(e) { //AJAX call var url = ../libs/ajax/identify.php?type=map* OpenLayers.loadURL(url, '', this, getPopUpPoint); *** ** function getPopUpPoint(response) { if (response.responseText.indexOf('no result') == -1) { // response.responseText = http://www.website/data/page_12_89000.html CreateClueTip(response.responseText); } else { alert(No result); } } The variable response.responseText is the html page (rel or href) to open within the clueTip. And I declared: div class=tip href= rel= title=Checking Point style=display:none/div $().ready(function() { $('.tip').cluetip({ width:'300', height:'600', cluetipClass: 'jtip', arrows: true, dropShadow: false, hoverIntent: false, sticky: true, mouseOutClose: false, closePosition: 'title', closeText: 'img src=/images/cross.png alt=close /' }); *** function CreateClueTip(html_page) { //change rel value with html_page $('.tip').trigger('mouseover'); } From JS I call the function CreateClueTip and it has to make visible the div class=tip and it has to change the rel value with the response.responseText (html page path), is that possible? I checked this: http://groups.google.it/group/jquery-en/browse_thread/thread/5bc757451f2ebf8c?q=cluetip+from+javascript#aa4a2ffb8d2b2382 I need to call the CreateClueTip when the user clicks on the map (trigger: function(e)) and it doesn't work, why? Thanks!
[jQuery] Re: Cycle - Goto (or) pagerAnchorBuilder (or) Something Else......Confusion
just not getting it. How do I go to a specific the slide that needs to be displayed from the Cycle detail slides (using a 'next/prev' nav) without pagerAnchorBuilder, and still maintain the navigation of the Cycle detail slides? Nick, if you need to start a slideshow on a specific slide then use the 'startingSlide' option. If you need to advance a currently running slideshow to a particular slide index you can call the cycle fn and pass it the index. $('#slideshow').cycle({ startingSlide: 4 }); $('#slideshow').cycle(4)
[jQuery] Re: Creating callbacks using Cycle plugin
Currently, I have implemented a small image gallery using the jQuery Cycle plugin. It's working perfectly but I would also like to add callbacks. How do I successfully do this? I currently have: jQuery(document).ready(function(){ jQuery('#frame1').cycle({ fx:'fade', speed:'500', timeout: 0, next:'#next2', prev:'#prev2', }); }); Watch out for that last comma (after '#prev2', that's a script killer in IE). What I would like to happen is as a user scrolls to the next image (which fades in) the image and its corresponding caption appears (basic styled text below it). The same action also when a user clicks previous for the last image. The 'before' and 'after' callbacks will help you here. Check out this demo: http://www.malsup.com/jquery/cycle/after.html Also, I have general concerns about script loading. I have quite of number of linked js files in my header. Seemingly, when you select and view a webpage for the first time, the above script doesn't work - only when you hit refresh does the image gallery appear properly. Is this a problem at all? Hard to say without seeing it in action. Can you post a link?
[jQuery] Re: the jquery form plugin and the accents !
I submit a form (to test.php) in which there are text fields and one file field + enctype='multipart/form-data'. The html page has a meta which defines the charset to iso 8859-1 The test.php module begin with header('content-type:text/ html;charset=iso-8859-1'); I read the text fields like this: $nom = htmlspecialchars(addslashes ($_POST['nom'])); I read the upload file like this: $tmp_name = $_FILES['photo'] ['tmp_name']; Here is the problem: If my text fields contain accents and the file field is empty then $name is correct. If my text fields contain accents and the file field is NOT empty then $name is NOT correct. example: René gives Ren? I don't understand the impact of the $_FILES on $_POST. Does the jquery plugin changes the charset ? Does it work correctly if you submit the form with JS disabled? Can you post a link?
[jQuery] Re: A question for John Resig
Extra function calls sure - plus there's really no need for those methods, they're already a part of JavaScript. typeof FOO === string typeof FOO === number typeof FOO === boolean --John On Tue, Feb 17, 2009 at 11:53 PM, pbcomm pbc...@gmail.com wrote: This might be a stupid question, but I have to ask ... What is the reason for not having functions like isString, isNumber, isBoolean, etc? Is it just because that would create extra function calls?
[jQuery] Re: Creating callbacks using Cycle plugin
Oh that's great Mike thanks for helping me! I think with the script loading, I've streamlined it and so now I've linked everything which can either be linked js files or external CSS files. So hopefully that will do the trick. It seems to have work with things I have done just now. Can you explain to me about the last comma? As I am don't have a wide knowledge of jQuery. Thanks. On Feb 18, 11:52 pm, Mike Alsup mal...@gmail.com wrote: Currently, I have implemented a small image gallery using the jQuery Cycle plugin. It's working perfectly but I would also like to add callbacks. How do I successfully do this? I currently have: jQuery(document).ready(function(){ jQuery('#frame1').cycle({ fx:'fade', speed:'500', timeout: 0, next:'#next2', prev:'#prev2', }); }); Watch out for that last comma (after '#prev2', that's a script killer in IE). What I would like to happen is as a user scrolls to the next image (which fades in) the image and its corresponding caption appears (basic styled text below it). The same action also when a user clicks previous for the last image. The 'before' and 'after' callbacks will help you here. Check out this demo: http://www.malsup.com/jquery/cycle/after.html Also, I have general concerns about script loading. I have quite of number of linked js files in my header. Seemingly, when you select and view a webpage for the first time, the above script doesn't work - only when you hit refresh does the image gallery appear properly. Is this a problem at all? Hard to say without seeing it in action. Can you post a link?
[jQuery] Re: Extending a plugin
I might have used the wrong terminology here so I will explain what I want to do. I am currently using the jquery.form plugin to make my forms 'ajaxable' where needed. However, I would like to add some extra functionality to the plugin which is specific to my application. In this circumstance is it better to write the functionality into the plugin directly or 'extend' it somehow? I say 'extend' when all I really need is to add some functions. Some forms won't need this extra functionality so extending it seems to me, to be the way forward. Would I use extend() to do this or is there some other syntactic sugar I can use? I guess it depends what you want to change. Using extend you can redefine any of the public functions, but the private functions will remain private. $.extend($.fn, { ajaxSubmit: function(options) { // your code here } }); The above it no different that just doing this $.fn.ajaxSubmit = function(options) { // your code here }; Mike
[jQuery] Re: Extending a plugin
On Wed, Feb 18, 2009 at 4:47 PM, crungmun...@googlemail.com crungmun...@googlemail.com wrote: Hi, However, I would like to add some extra functionality to the plugin which is specific to my application. In this circumstance is it better to write the functionality into the plugin directly or 'extend' it somehow? I ran into this myself a couple of times. The jQuery framework leaves much to be desired in this arena and there is considerable lack of proper OO inheritance from what I am aware of (I have only been on jQuery for 2-3 weeks). I recently tried to extend the ui.spinner var mspinner = $.extend({}, $.ui.spinner.prototype, { _init: function(){ $.ui.spinner.prototype._init.call(this); } }); $.widget(ui.mspinner, mspinner); But _init is private so that didn't work. I ran into some other errors such as options.items not defined for reasons I didn't care to explore. It's not possible to override functions and there were a range of other issues that I ran into that I just decided to drop the idea. If someone knows of a better way or tried and tested design pattern, I too would be interested. -- Aleem
[jQuery] [validate]: Tricky multiple field validation problem
I want to include an optional set of date setting fields on a form - A dropdown for day (01 - 31 with a blank value), a dropdown for month (01 - 31 with a blank value) and a four digit year input field. The validation is as follows: * The date is optional, if all fields are blank then assume no date * If one of the fields is not blank then all of them have to have a value * The three fields taken together must specify a valid date (no 31st of February) * The date must be today or in the future How do I do this with the jQuery validate plugin?
[jQuery] Re: Checkboxes enabled/disable button
if ($(checkbox[name='my_checkbox']:checked).length == 0) { //None are checked } else { //At least one is checked } Sir Rawlins wrote: Hello Guys, Fairly noobish here so hoping to learn a little something from this challenge. I have a form which contains a bunch of different checkboxes (all the same name) and a bunch of different button elements. I want to by default have these buttons disabled unless at least one checkbox is checked, if no checkboxes are checked then they need to be disabled. input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / button type=buttonClick me to do something/button button type=buttonClick me to do something else/button button type=buttonClick me to do something cool/button button type=buttonClick me to do nothing/button If this were just a single checkbox then I could figure this out without too much hassle but I'm unsure as to how I should be checking is any of the boxes are checked, presumably we can do some sort of array count for instances of it or something? who knows? I'd appreciate your thoughts on this guys. Robert
[jQuery] Auto-Replacing HTML-entities
Hello! I have setup a simple editor site for a image gallery where the user can visually edit (sort entries, add entries, edit captions) the HTML of a ul. When finished the content gets saved via PHP. Is there a simple way to have special characters in image captions converted into HTML entities? The way I read the then transmitted ul is: var html = $('#container').html(); $('#textfield').text('html'); The content of the #textfield is then written into a new HTML file. Is there a jQuery-way to do it or would I have to use a RegExp? Thanks!
[jQuery] Re: Creating callbacks using Cycle plugin
After looking at the example, I'm afraid I don't know how to work out what I need to define for the functionality that I need, as I've looked at the Intermediate Section also. If I have this: div id=frame1img src= alt= title= /img src= /alt = title= //div a id=prev2 href=#Prev/a a id=next2 href=#Next/a and I assign each image's alt and/or title, how can I evoke them as captions below each image after clicking prev/next? On Feb 19, 12:00 am, HM-User m.lawrencehu...@gmail.com wrote: Oh that's great Mike thanks for helping me! I think with the script loading, I've streamlined it and so now I've linked everything which can either be linked js files or external CSS files. So hopefully that will do the trick. It seems to have work with things I have done just now. Can you explain to me about the last comma? As I am don't have a wide knowledge of jQuery. Thanks. On Feb 18, 11:52 pm, Mike Alsup mal...@gmail.com wrote: Currently, I have implemented a small image gallery using the jQuery Cycle plugin. It's working perfectly but I would also like to add callbacks. How do I successfully do this? I currently have: jQuery(document).ready(function(){ jQuery('#frame1').cycle({ fx:'fade', speed:'500', timeout: 0, next:'#next2', prev:'#prev2', }); }); Watch out for that last comma (after '#prev2', that's a script killer in IE). What I would like to happen is as a user scrolls to the next image (which fades in) the image and its corresponding caption appears (basic styled text below it). The same action also when a user clicks previous for the last image. The 'before' and 'after' callbacks will help you here. Check out this demo: http://www.malsup.com/jquery/cycle/after.html Also, I have general concerns about script loading. I have quite of number of linked js files in my header. Seemingly, when you select and view a webpage for the first time, the above script doesn't work - only when you hit refresh does the image gallery appear properly. Is this a problem at all? Hard to say without seeing it in action. Can you post a link?
[jQuery] Re: Auto-Replacing HTML-entities
Since you're saving it with php why not just use the php functions that do the same? http://us3.php.net/htmlentities cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Frederik Ring frederik.r...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/18/2009 08:14 AM Subject:[jQuery] Auto-Replacing HTML-entities Hello! I have setup a simple editor site for a image gallery where the user can visually edit (sort entries, add entries, edit captions) the HTML of a ul. When finished the content gets saved via PHP. Is there a simple way to have special characters in image captions converted into HTML entities? The way I read the then transmitted ul is: var html = $('#container').html(); $('#textfield').text('html'); The content of the #textfield is then written into a new HTML file. Is there a jQuery-way to do it or would I have to use a RegExp? Thanks! inline: graycol.gifinline: ecblank.gif
[jQuery] Re: Auto-Replacing HTML-entities
Perfect! I'm not exactly good at PHP, so I didn't know about that, but it seems to be exactly what I am looking for! Thanks! On Feb 18, 2:19 pm, Michael Lawson mjlaw...@us.ibm.com wrote: Since you're saving it with php why not just use the php functions that do the same? http://us3.php.net/htmlentities cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Frederik Ring frederik.r...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/18/2009 08:14 AM Subject: [jQuery] Auto-Replacing HTML-entities Hello! I have setup a simple editor site for a image gallery where the user can visually edit (sort entries, add entries, edit captions) the HTML of a ul. When finished the content gets saved via PHP. Is there a simple way to have special characters in image captions converted into HTML entities? The way I read the then transmitted ul is: var html = $('#container').html(); $('#textfield').text('html'); The content of the #textfield is then written into a new HTML file. Is there a jQuery-way to do it or would I have to use a RegExp? Thanks! graycol.gif 1KViewDownload ecblank.gif 1KViewDownload
[jQuery] Re: A question for John Resig
I know they are there and I've used added functions to save on the code size, which makes a big difference when used a lot. That's why I wanted to see if there are some other drawbacks I was not aware of. On Feb 18, 7:57 am, John Resig jere...@gmail.com wrote: Extra function calls sure - plus there's really no need for those methods, they're already a part of JavaScript. typeof FOO === string typeof FOO === number typeof FOO === boolean --John On Tue, Feb 17, 2009 at 11:53 PM, pbcomm pbc...@gmail.com wrote: This might be a stupid question, but I have to ask ... What is the reason for not having functions like isString, isNumber, isBoolean, etc? Is it just because that would create extra function calls?
[jQuery] Hide/Show when Check Box is selected
Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Auto-Replacing HTML-entities
Great! And if you need any PHP help, feel free to email me directly! I know it better than I do javascript ;) cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Frederik Ring frederik.r...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/18/2009 08:28 AM Subject:[jQuery] Re: Auto-Replacing HTML-entities Perfect! I'm not exactly good at PHP, so I didn't know about that, but it seems to be exactly what I am looking for! Thanks! On Feb 18, 2:19 pm, Michael Lawson mjlaw...@us.ibm.com wrote: Since you're saving it with php why not just use the php functions that do the same? http://us3.php.net/htmlentities cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Frederik Ring frederik.r...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/18/2009 08:14 AM Subject: [jQuery] Auto-Replacing HTML-entities Hello! I have setup a simple editor site for a image gallery where the user can visually edit (sort entries, add entries, edit captions) the HTML of a ul. When finished the content gets saved via PHP. Is there a simple way to have special characters in image captions converted into HTML entities? The way I read the then transmitted ul is: var html = $('#container').html(); $('#textfield').text('html'); The content of the #textfield is then written into a new HTML file. Is there a jQuery-way to do it or would I have to use a RegExp? Thanks! graycol.gif 1KViewDownload ecblank.gif 1KViewDownload inline: graycol.gifinline: ecblank.gif
[jQuery] Re: Tablesorter update
Hi, i have fixed some css issus with IE and made some minor js changes. Feel free to take a look at the example page which is know in english. Best regards Sören On 17 Feb., 16:49, soeren.kri...@googlemail.com soeren.kri...@googlemail.com wrote: Hi, i have added some (for me) missing features to thetablesorterplugin: - optional ui theme support - locale support for additional date formats and decimal points - update the following parsers to support additional decimal points: digit, currency, percent - update date parser to support german dates - update date parser for short and medium dates You find the source and an example here: http://tablesorter.openwerk.dehttp://tablesorter.openwerk.de/script/jquery.tablesorter-update.js Best regards Sören Krings
[jQuery] Re: A question for John Resig
I know they are there and I've used added functions to save on the code size, which makes a big difference when used a lot. It doesn't make any difference save for a few characters.
[jQuery] Re: A question for John Resig
I don't know about Javascript, but a good deal depends on how that functionality is implemented, and what language you're in. They're not always the same thing, and shouldn't always be used like they are the same thing. Again though, they may be in Javascript, i'm not saying they're not. (I'm not really a javascript expert) In the Java language, for example, you have the instanceof operator. This is fine if you only need to check the type of something only a few times, but if it's a several times per unit time kinda thing, you start to run into efficiency problems. So using methods that make use of more efficient algorithms become the better way to go. cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Aleem B ale...@gmail.com To: jquery-en@googlegroups.com Date: 02/18/2009 08:36 AM Subject:[jQuery] Re: A question for John Resig I know they are there and I've used added functions to save on the code size, which makes a big difference when used a lot. It doesn't make any difference save for a few characters. inline: graycol.gifinline: ecblank.gif
[jQuery] Re: Tablesorter update
Hi, i have fixed some css issus with IE and made some minor js changes. Feel free to take a look at the example page which is now in english. Best regards Sören On 17 Feb., 16:49, soeren.kri...@googlemail.com soeren.kri...@googlemail.com wrote: Hi, i have added some (for me) missing features to thetablesorterplugin: - optional ui theme support - locale support for additional date formats and decimal points - update the following parsers to support additional decimal points: digit, currency, percent - update date parser to support german dates - update date parser for short and medium dates You find the source and an example here: http://tablesorter.openwerk.dehttp://tablesorter.openwerk.de/script/jquery.tablesorter-update.js Best regards Sören Krings
[jQuery] Re: cannot call twice: $(#foo).mywidget()
We'd love to help with this question over on the jQuery UI list, for the benefit of everyone there: http://groups.google.com/group/jquery-ui Thanks. - Richard On Wed, Feb 18, 2009 at 4:31 AM, Aleem B ale...@gmail.com wrote: I created a widget and figured that it can only be called once per element: $.widget('ui.mywidget', { _init: function() { alert('hello'); } } $.widget(ui.mywidget, mywidget); $(#foo).mywidget(); // alerts hello $(#foo).mywidget(); // doesn't do anything now I understand this is by design because _init acts like a static constructor. however, I want to create a widget to add a panel to #foo each time it's called so: $(#foo).addpanel(); $(#foo).addpanel(); But that obvioulsy fails.What's the work around or what is a better design? I don't want to do: $(#foo).addpanel(); $(#foo).addpanel(add); $(#foo).addpanel(add); because that requires an extra () call followed by (add), (add). -- Aleem
[jQuery] Re: Tablesorter update
Hi, i don´t think so. Tablesorter performance is the same with 1.2.6 and 1.3.1. On 17 Feb., 19:57, SteelRing steelr...@gmail.com wrote: Hi, thanks for the update. I see now you require jquery 1.3.1, is there any changes that would make it perform faster with 1.3.1? On Feb 17, 9:49 am, soeren.kri...@googlemail.com soeren.kri...@googlemail.com wrote: Hi, i have added some (for me) missing features to thetablesorterplugin: - optional ui theme support - locale support for additional date formats and decimal points - update the following parsers to support additional decimal points: digit, currency, percent - update date parser to support german dates - update date parser for short and medium dates You find the source and an example here: http://tablesorter.openwerk.dehttp://tablesorter.openwerk.de/script/j... Best regards Sören Krings
[jQuery] Re: [validate]: Tricky multiple field validation problem
You need a custom method and a required-dependency, roughly something like this: $.validator.addMethod(customDate, function(value, element) { var day = $(#day).val(), month = ...; return valid(day + month + year); }); function dateRequired() { return $(#day)[0].selectedIndex 0 $(#month)[0].selectedIndex 0 $(#year).val().length; } ... rules: { day: { required: dateRequired, customDate: true }, month: { required: dateRequired, customDate: true }, year: { required: dateRequired, customDate: true } } The dateRequired function assumes that the first option is the blank one. The customDate method needs to be completed, the existing date methods may help as reference. Jörn On Wed, Feb 18, 2009 at 2:07 PM, Gordon grj.mc...@googlemail.com wrote: I want to include an optional set of date setting fields on a form - A dropdown for day (01 - 31 with a blank value), a dropdown for month (01 - 31 with a blank value) and a four digit year input field. The validation is as follows: * The date is optional, if all fields are blank then assume no date * If one of the fields is not blank then all of them have to have a value * The three fields taken together must specify a valid date (no 31st of February) * The date must be today or in the future How do I do this with the jQuery validate plugin?
[jQuery] Clone with Select values copied
Hi, I had an issue with the clone() function in that it wasn't copying over select values. I've added this function to my page function cloneForm(id, withEvents) { var clone = $('#'+id).clone(withEvents); var selvals = []; $('#'+id+ select).each(function() { selvals.push($(this).val()); }); clone.find(select).each(function() { $(this).val(selvals.shift()); }); return clone; } which will clone the values as well. I'm a relative Jquery newbie so I imagine there is a better way of doing this, maybe over-riding/loading the clone function or putting it in the jquery source but I've a bit of a way to go till I'm confident of digging that deep. Hopefully this will be of some use to someone. Cheers Mark
[jQuery] Re: image rollover
Assign the event to the element li and not the image. Because if you display a text over the image, you will lose the event mouseover. $(document).ready(function() { $(li.episode).mouseover(function () { $(this).addClass(background); $('div.details').addClass(show); }); $(li.episode).mouseout(function () { $(this).removeClass(background); $('.details').removeClass(show); }); });
[jQuery] Validation Plugin: How to submit invalid form via JavaScript
Hi, I want to validate form and submit it via JavaScript even if it isn't valid, and don't do it if the submit button is pressed $(document).ready(function() { validator = $(#editUserForm).validate( { focusInvalid: false, ignoreTitle: true, onkeyup: false }); ... }); And then I'm trying to submit form after onclick on some control $(#someControl).click(function() { // do something $(#filterForm).submit(); }); Unfortunately, form doesn't via JS submit if validation failed
[jQuery] Re: Validation Plugin: How to submit invalid form via JavaScript
If you're trying to submit the form even if it doesn't validate...then why validate in the first place? i'm confused cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: shmolch obuluchevsk...@gmail.com To: jQuery (English) jquery-en@googlegroups.com Date: 02/18/2009 09:26 AM Subject:[jQuery] Validation Plugin: How to submit invalid form via JavaScript Hi, I want to validate form and submit it via JavaScript even if it isn't valid, and don't do it if the submit button is pressed $(document).ready(function() { validator = $(#editUserForm).validate( { focusInvalid: false, ignoreTitle: true, onkeyup: false }); ... }); And then I'm trying to submit form after onclick on some control $(#someControl).click(function() { // do something $(#filterForm).submit(); }); Unfortunately, form doesn't via JS submit if validation failed inline: graycol.gifinline: ecblank.gif
[jQuery] [jQuery][validate] plugin fails on Safari
Hi Folks, Wondered if anyone could help on this, I've been stuck on it for quite some time. I'm trying to validate a date field using a UK date, here's my code: $(document).ready(function(){ $('#arrival-arrival-date').datepicker({ minDate: new Date (),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false }); $.validator.addMethod('ukdate', function(value, element) { var regex = /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/] ((19|20)\d\d)$/; console.log(value.match(regex)); return this.optional(element) || value.match(regex); }, Please specify a UK date); // validate signup form on keyup and submit $(#theForm).validate({ debug:true, errorClass: 'redBorder', rules: { 'arrival-arrival-date': { ukdate: true}, 'arrival-stay-duration': { required: true, min: 1} }, highlight: function(element, errorClass) { $(element).fadeOut(function() { $(element).fadeIn() }) }, messages: { 'arrival-arrival-date':'', 'arrival-stay-duration':'' }, highlight: function(element, errorClass) { $(element).addClass(errorClass); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass); }, errorPlacement: function(error, element) { error.appendTo('errorNotes'); } }); And you can see a demo of it in action at http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/. It works fine on IE, Opera and FF, fails in Safari for any dates where the dd part is higher than 12. I think it must be an issue with the validator plugin as I've tested the regular expression on its own in Saari and it works fine. Cheers George
[jQuery] [Validate] plugin fails on Safari
Hi Folks, Wondered if anyone could help on this, I've been stuck on it for quite some time. I'm trying to validate a date field using a UK date, here's my code: $(document).ready(function(){ $('#arrival-arrival-date').datepicker({ minDate: new Date (),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false }); $.validator.addMethod('ukdate', function(value, element) { var regex = /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/] ((19|20)\d\d)$/; console.log(value.match(regex)); return this.optional(element) || value.match(regex); }, Please specify a UK date); // validate signup form on keyup and submit $(#theForm).validate({ debug:true, errorClass: 'redBorder', rules: { 'arrival-arrival-date': { ukdate: true}, 'arrival-stay-duration': { required: true, min: 1} }, highlight: function(element, errorClass) { $(element).fadeOut(function() { $(element).fadeIn() }) }, messages: { 'arrival-arrival-date':'', 'arrival-stay-duration':'' }, highlight: function(element, errorClass) { $(element).addClass(errorClass); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass); }, errorPlacement: function(error, element) { error.appendTo('errorNotes'); } }); And you can see a demo of it in action at http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/. It works fine on IE, Opera and FF, fails in Safari for any dates where the dd part is higher than 12. I think it must be an issue with the validator plugin as I've tested the regular expression on its own in Saari and it works fine. Cheers George
[jQuery] Re: Checkboxes enabled/disable button
Morningz, Thank you for this! I made a couple of small changes, like so: if ($(inp...@name='my_checkbox']:checked).length == 0) { and it worked a real treat!! Thank you for your advice, I appreciate it! Robert -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: 18 February 2009 13:11 To: jQuery (English) Subject: [jQuery] Re: Checkboxes enabled/disable button if ($(checkbox[name='my_checkbox']:checked).length == 0) { //None are checked } else { //At least one is checked } Sir Rawlins wrote: Hello Guys, Fairly noobish here so hoping to learn a little something from this challenge. I have a form which contains a bunch of different checkboxes (all the same name) and a bunch of different button elements. I want to by default have these buttons disabled unless at least one checkbox is checked, if no checkboxes are checked then they need to be disabled. input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / button type=buttonClick me to do something/button button type=buttonClick me to do something else/button button type=buttonClick me to do something cool/button button type=buttonClick me to do nothing/button If this were just a single checkbox then I could figure this out without too much hassle but I'm unsure as to how I should be checking is any of the boxes are checked, presumably we can do some sort of array count for instances of it or something? who knows? I'd appreciate your thoughts on this guys. Robert
[jQuery] Re: .click to start dropdown, hover out to clear (mixing the two)
Hi Pete, You don't need to use .hover() with an empty function. You can use .mouseleave() in jQuery 1.3.x or .bind('mouseleave') in 1.2.6. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 18, 2009, at 12:28 AM, pedalpete wrote: Ok, actually got this working with the following code [code] $('form#filterList span.holdDate').click(function(){ $('span#datePickers, div.datepicker').slideDown('fast'); $('span#datePickers, div.datepicker').hover( function(){}, function(){ $('div.datepicker').slideUp('slow'); }); }, function(){ }); [/code]
[jQuery] Tabs, how to find what kind of object....
I got this problem var $tabs = parent.$('#operativitaframe').contents().find ('#tabsContainer').tabs(); alert($tabs); This prints [object Object]; how can I know if this is the tabs object instead of something else? If i cycle on it and print all his content I got this length, 0, prevObject, init, jquery, size, get, pushStack, setArray, each, index, attr, css, text, wrapAll, wrapInner, wrap, append, prepend, before, after, end, find, clone, filter, not, add, is, hasClass, val, html, replaceWith, eq, slice, map, andSelf, data, removeData, domManip, extend, parent, parents, next, prev, nextAll, prevAll, siblings, children, contents, appendTo, prependTo, insertBefore, insertAfter, replaceAll, removeAttr, addClass, removeClass, toggleClass, remove, empty, height, width, bind, one, unbind, trigger, triggerHandler, toggle, hover, ready, blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, change, select, submit, keydown, keypress, keyup, error, _load, serialize, serializeArray, ajaxStart, ajaxStop, ajaxComplete, ajaxError, ajaxSuccess, ajaxSend, show, hide, _toggle, slideDown, slideUp, slideToggle, fadeIn, fadeOut, fadeTo, animate, queue, stop, dequeue, offset, position, offsetParent, scrollLeft, scrollTop, innerHeight, outerHeight, innerWidth, outerWidth, tabs, triggerTab, disableTab, enableTab, activeTab, bgiframe, bgIframe, dialog, droppable, draggable, resizable, var selected = $tabs.data('selected.tabs'); alert(selected); This prints out undefined var number = $tabs.tabs('length'); alert(number); This prints out [object Object] If I cycle on it I got the same output as above... I'm going crazy with this problem to access a tab in an iframe from another iframe.
[jQuery] Re: Checkboxes enabled/disable button
Don't use @ well, don't use it if you plan on ever using jQuery over version 1.3... because it's not supported even if you are using an older version, loose the @, it's not needed On Feb 18, 10:13 am, Robert Rawlins robert.rawl...@thinkbluemedia.co.uk wrote: Morningz, Thank you for this! I made a couple of small changes, like so: if ($(inp...@name='my_checkbox']:checked).length == 0) { and it worked a real treat!! Thank you for your advice, I appreciate it! Robert -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: 18 February 2009 13:11 To: jQuery (English) Subject: [jQuery] Re: Checkboxes enabled/disable button if ($(checkbox[name='my_checkbox']:checked).length == 0) { //None are checked } else { //At least one is checked } Sir Rawlins wrote: Hello Guys, Fairly noobish here so hoping to learn a little something from this challenge. I have a form which contains a bunch of different checkboxes (all the same name) and a bunch of different button elements. I want to by default have these buttons disabled unless at least one checkbox is checked, if no checkboxes are checked then they need to be disabled. input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / button type=buttonClick me to do something/button button type=buttonClick me to do something else/button button type=buttonClick me to do something cool/button button type=buttonClick me to do nothing/button If this were just a single checkbox then I could figure this out without too much hassle but I'm unsure as to how I should be checking is any of the boxes are checked, presumably we can do some sort of array count for instances of it or something? who knows? I'd appreciate your thoughts on this guys. Robert
[jQuery] Re: Tabs, how to find what kind of object....
Get Firebug. Not meaning to sound flippant, but debugging with alerts is painful and living in the past. Firebug will allow you to see inside the object by doing console.log($tabs). To save you some frustration, if you try and log a string plus the object to the Firebug console you'll get [object Object] again. Then I'd suggest breaking down your selectors: make sure you can access the target iframe's content from the parent (cross browser if that's important to you), then make sure you can see the parent window from the source iframe. Once you've acheived those goals, you can just concatenate the selectors. http://getfirebug.com/ On Feb 18, 7:23 am, m.ugues m.ug...@gmail.com wrote: I got this problem var $tabs = parent.$('#operativitaframe').contents().find ('#tabsContainer').tabs(); alert($tabs); This prints [object Object]; how can I know if this is the tabs object instead of something else? If i cycle on it and print all his content I got this length, 0, prevObject, init, jquery, size, get, pushStack, setArray, each, index, attr, css, text, wrapAll, wrapInner, wrap, append, prepend, before, after, end, find, clone, filter, not, add, is, hasClass, val, html, replaceWith, eq, slice, map, andSelf, data, removeData, domManip, extend, parent, parents, next, prev, nextAll, prevAll, siblings, children, contents, appendTo, prependTo, insertBefore, insertAfter, replaceAll, removeAttr, addClass, removeClass, toggleClass, remove, empty, height, width, bind, one, unbind, trigger, triggerHandler, toggle, hover, ready, blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, change, select, submit, keydown, keypress, keyup, error, _load, serialize, serializeArray, ajaxStart, ajaxStop, ajaxComplete, ajaxError, ajaxSuccess, ajaxSend, show, hide, _toggle, slideDown, slideUp, slideToggle, fadeIn, fadeOut, fadeTo, animate, queue, stop, dequeue, offset, position, offsetParent, scrollLeft, scrollTop, innerHeight, outerHeight, innerWidth, outerWidth, tabs, triggerTab, disableTab, enableTab, activeTab, bgiframe, bgIframe, dialog, droppable, draggable, resizable, var selected = $tabs.data('selected.tabs'); alert(selected); This prints out undefined var number = $tabs.tabs('length'); alert(number); This prints out [object Object] If I cycle on it I got the same output as above... I'm going crazy with this problem to access a tab in an iframe from another iframe.
[jQuery] Re: Tabs, how to find what kind of object....
I got this problem var $tabs = parent.$('#operativitaframe').contents().find ('#tabsContainer').tabs(); alert($tabs); This prints [object Object]; how can I know if this is the tabs object instead of something else? $tabs is actually a jQuery object. tabs() may add some additional new properties (prevObject, context) but it would be an unreliable to check against those properties as other objects may add similar properties. If you are assigning to $tabs when calling tabs() why would you need to check it again? Calling tabs() again should not be an issue or you could work around it by setting a flag.
[jQuery] Re: Hide/Show when Check Box is selected
Hi Miguel, you can use the click trigger of the checkbox: form show secret: input id=checkbox type=checkbox/ div id=div secret field: input type=text / /div /from $(#div).hide(); $(#checkbox).click(function(){ if ( this.checked ) { $(#div).show(); } else { $(#div).hide(); } }) by(e) Stephan 2009/2/18 shapper mdmo...@gmail.com: Hello, On a form how can I Show a fieldset when a checkbox is Selected and Hide the same fieldset when the same checkbox is unselected? Thanks, Miguel
[jQuery] Re: Javascript Generated by $()load does not render
On Tuesday 17 February 2009, Alexandre Plennevaux wrote: i suppose that you change try specifying the dataType as script that your ajax calls expect: Taken from: http://docs.jquery.com/Ajax/jQuery.ajax dataType The type of data that you're expecting back from the server. If none is specified, jQuery will intelligently pass either responseXML or responseText to your success callback, based on the MIME type of the response. The available types (and the result passed as the first argument to your success callback) are: Thank you. That clears up a lot. But the question that remains is that two different types of data are returned: 1)Script 2)Text The answer may be in the mime type. $()load is so much easier to use. I will research futher. regards tim
[jQuery] Re: [Validate] plugin fails on Safari
Regular expressions are read to read, can't spot any obvious error with that, especially considering that it fails only in Safari. Here is a custom method for italian dates, not using regex, maybe it helps: jQuery.validator.addMethod( dateITA, function(value, element) { var check = false; var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/ if( re.test(value)){ var adata = value.split('/'); var gg = parseInt(adata[0],10); var mm = parseInt(adata[1],10); var = parseInt(adata[2],10); var xdata = new Date(,mm-1,gg); if ( ( xdata.getFullYear() == ) ( xdata.getMonth () == mm - 1 ) ( xdata.getDate() == gg ) ) check = true; else check = false; } else check = false; return this.optional(element) || check; }, Please enter a correct date ); From: http://jquery.bassistance.de/validate/additional-methods.js Jörn On Wed, Feb 18, 2009 at 3:25 PM, George george.bea...@googlemail.com wrote: Hi Folks, Wondered if anyone could help on this, I've been stuck on it for quite some time. I'm trying to validate a date field using a UK date, here's my code: $(document).ready(function(){ $('#arrival-arrival-date').datepicker({ minDate: new Date (),defaultDate: +1,dateFormat: 'dd/mm/yy',constrainInput: false }); $.validator.addMethod('ukdate', function(value, element) { var regex = /^(0[1-9]|[12][0-9]|3[01])[\/](0[1-9]|1[012])[\/] ((19|20)\d\d)$/; console.log(value.match(regex)); return this.optional(element) || value.match(regex); }, Please specify a UK date); // validate signup form on keyup and submit $(#theForm).validate({ debug:true, errorClass: 'redBorder', rules: { 'arrival-arrival-date': { ukdate: true}, 'arrival-stay-duration': { required: true, min: 1} }, highlight: function(element, errorClass) { $(element).fadeOut(function() { $(element).fadeIn() }) }, messages: { 'arrival-arrival-date':'', 'arrival-stay-duration':'' }, highlight: function(element, errorClass) { $(element).addClass(errorClass); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass); }, errorPlacement: function(error, element) { error.appendTo('errorNotes'); } }); And you can see a demo of it in action at http://dev.letsbookrooms.co.uk/uk/perthshire/parklandshotel/. It works fine on IE, Opera and FF, fails in Safari for any dates where the dd part is higher than 12. I think it must be an issue with the validator plugin as I've tested the regular expression on its own in Saari and it works fine. Cheers George
[jQuery] Re: Checkboxes enabled/disable button
Thanks for the heads up on that, I've obviously picked that up as a bad habbit from some examples built on older versions, I'll be sure to get rid of it! :-) Thanks Robert -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: 18 February 2009 15:49 To: jQuery (English) Subject: [jQuery] Re: Checkboxes enabled/disable button Don't use @ well, don't use it if you plan on ever using jQuery over version 1.3... because it's not supported even if you are using an older version, loose the @, it's not needed On Feb 18, 10:13 am, Robert Rawlins robert.rawl...@thinkbluemedia.co.uk wrote: Morningz, Thank you for this! I made a couple of small changes, like so: if ($(inp...@name='my_checkbox']:checked).length == 0) { and it worked a real treat!! Thank you for your advice, I appreciate it! Robert -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of MorningZ Sent: 18 February 2009 13:11 To: jQuery (English) Subject: [jQuery] Re: Checkboxes enabled/disable button if ($(checkbox[name='my_checkbox']:checked).length == 0) { //None are checked } else { //At least one is checked } Sir Rawlins wrote: Hello Guys, Fairly noobish here so hoping to learn a little something from this challenge. I have a form which contains a bunch of different checkboxes (all the same name) and a bunch of different button elements. I want to by default have these buttons disabled unless at least one checkbox is checked, if no checkboxes are checked then they need to be disabled. input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / input type=checkbox name=my_checkbox / button type=buttonClick me to do something/button button type=buttonClick me to do something else/button button type=buttonClick me to do something cool/button button type=buttonClick me to do nothing/button If this were just a single checkbox then I could figure this out without too much hassle but I'm unsure as to how I should be checking is any of the boxes are checked, presumably we can do some sort of array count for instances of it or something? who knows? I'd appreciate your thoughts on this guys. Robert
[jQuery] Re: Order Items. Please help me. Thank You.
Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be serialized if we want to post the data ol = $('#Themes').bind('click',function(e){//event delegation for removing themes, livequery's fine, but this works too e = $(e.target); if(e.is('a')){ var li_index = $(this).children('li').index(e.parents('li')); themes =$.grep(themes, function(n,i){ return (i != li_index); }); buildThemesList(); } return false; }); //Add theme $('#AddTheme').click(function(){ var levels = $('input:checkbox:checked'), subject = $('#Subject').val (), temptheme = []; //validate before we go any further to avoid unnecessary operations if(levels.length==0 || subject == ''){ return false; } //process subject temptheme.push(subject); //process levels var levelCsv = []; //array to hold the levels levels.each(function(){ levelCsv.push(this.value); }); temptheme.push(levelCsv); //process note temptheme.push($('#Note').val()); //finally, add to the themes array themes.push(temptheme); //generate markup by rebuilding, buildThemesList(); }); function buildThemesList(){ ol.empty(); //more string concatenation than I like, but OK if you aren't building a huge list $.each(themes,function(i,t){ //this handles the li content var li = $('li').addClass('Themes').html(t[0]+'br /' +(t[1].length2?t[1].join(', ').replace(/(,\s)(\w+)$/,' e $2'):t [1].join(', '))+'br /' +(t[2]==''?'':t[2]+'br /') +'a href=#Remove class=RemoveRemove/a' ).appendTo(ol); //now the inputs, this could also be done in another loop with an array of names, if it gets longer; and the brackets in the name are still a bad idea $('input').attr({'type':'hidden','name':'Themes['+i +'].Subject'}).val(t[0]).appendTo(li); $('input').attr({'type':'hidden','name':'Themes['+i +'].LevelCsv'}).val(t[1].join()).appendTo(li); $('input').attr({'type':'hidden','name':'Themes['+i+'].Note'}).val (t[2]).appendTo(li); }); //just to keep things exactly as the original example's
[jQuery] Re: image rollover
You can take a slightly different approach, which might simplify your markup, css and js. Since you're using absolute positioning, you can absolutely position your image over your text, then just toggle the opacity on hover to reveal the text underneath. One advantage with this approach is you're always 'over' the image, so there's no issue of which element has focus and thus firing the mouseout. Here's the markup: ul li class=episode pText to be shown on mouse over/p img src=/images/image1.jpg/ /li li class=episode pText to be shown on mouse over/p img src=/images/image2.jpg/ /li /ul Here's the CSS (you'll also need to size the LI's width and height to the image size): li.episode{ position:relative; } li.episode img{ position:absolute; top:0; left:0; } li.episode img.trans{ opacity: .15; /* Standard: FF gt 1.5, Opera, Safari */ filter: alpha(opacity=15); /* IE lt 8 */ -ms-filter: alpha(opacity=15); /* IE 8 */ -khtml-opacity: .15; /* Safari 1.x */ -moz-opacity: .15; /* FF lt 1.5, Netscape */ } Here's the js: $('.episode img').hover( function(){ $(this).addClass('trans'); }, function(){ $(this).removeClass('trans'); } ); Btw, you don't need display:block on a div, it's a block level element. On Feb 18, 6:20 am, Leonardo K leo...@gmail.com wrote: Assign the event to the element li and not the image. Because if you display a text over the image, you will lose the event mouseover. $(document).ready(function() { $(li.episode).mouseover(function () { $(this).addClass(background); $('div.details').addClass(show); }); $(li.episode).mouseout(function () { $(this).removeClass(background); $('.details').removeClass(show); }); });
[jQuery] Re: Traversing
Hi, Here are a couple of ways to tackle this. First just using parent(). This traverses up to the outer table and then uses that as the context for selecting table.b : $(table.a).click(function(){ var parent = $(this).parent().parent().parent(); $('table.b', parent).toggle(); }); Second traverses up to the tr and then uses the next tr as the context for selecting tabel.b : $(table.a).click(function(){ var parent = $(this).parents('tr').next(); $('table.b', parent).toggle(); }); Personally, I wouldn't rely on the structure and/or sequence of the HTML to tie the table.a and table.b together. I'd use a class or id attribute to tie them together. Paul On Feb 18, 9:59 am, Turtle3027 becool...@gmail.com wrote: The following HTML is inside a loop, so it can be repeated many times over. table width=600 border=0 cellspacing=0 cellpadding=0 tr tdtable class=atrtd/td/tr/table/td td rowspan='2'nbsp;/td /tr tr tdtable class=btrtd/td/tr/table/td /tr /table I have a click function on table.a All table.b are given hide() How do I show() only the table.b that directly follows the table.a that has been clicked? I have been trying something like: $(table.a).click(function(){ $(this). From here I dont know whether to do parent() or next() or how to move across the tr and td to table.b
[jQuery] Re: Order Items. Please help me. Thank You.
Scripts block other assets from downloading, so the most appropriate place for them (most of the time), is at the close of the body. This allows your page to render, and then allows you to add behavior as progressive enhancement. It's generally good practice; Google progressive enhancement/graceful degradation for more on this. You can still include your script, just include it at the close of the body. Wrap it in a domready function if you like, I usually do that; one consequence of including your scripts at the end of the page is the DOM has been rendered already--which is why mine works :). If you want to keep the script external AND in the head, then you'll have to wrap the code in a domready function. On Feb 18, 8:25 am, shapper mdmo...@gmail.com wrote: Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be serialized if we want to post the data ol = $('#Themes').bind('click',function(e){//event delegation for removing themes, livequery's fine, but this works too e = $(e.target); if(e.is('a')){ var li_index = $(this).children('li').index(e.parents('li')); themes =$.grep(themes, function(n,i){ return (i != li_index); }); buildThemesList(); } return false; }); //Add theme $('#AddTheme').click(function(){ var levels = $('input:checkbox:checked'), subject = $('#Subject').val (), temptheme = []; //validate before we go any further to avoid unnecessary operations if(levels.length==0 || subject == ''){ return false; } //process subject temptheme.push(subject); //process levels var levelCsv = []; //array to hold the levels levels.each(function(){ levelCsv.push(this.value); }); temptheme.push(levelCsv); //process note temptheme.push($('#Note').val()); //finally, add to the themes array themes.push(temptheme); //generate markup by rebuilding, buildThemesList(); }); function buildThemesList(){ ol.empty(); //more string concatenation than I like, but OK if you aren't building a huge list $.each(themes,function(i,t){ //this handles the li content var li = $('li').addClass('Themes').html(t[0]+'br /'
[jQuery] Re: Javascript Generated by $()load does not render
you can use load, you just have to setup the ajaxSetup controlling your ajax main parameters so you set it to your liking, then you call the load(). It is built on top of the ajax method to ease its use. See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options On Wed, Feb 18, 2009 at 5:18 PM, Tim Johnson t...@johnsons-web.com wrote: On Tuesday 17 February 2009, Alexandre Plennevaux wrote: i suppose that you change try specifying the dataType as script that your ajax calls expect: Taken from: http://docs.jquery.com/Ajax/jQuery.ajax dataType The type of data that you're expecting back from the server. If none is specified, jQuery will intelligently pass either responseXML or responseText to your success callback, based on the MIME type of the response. The available types (and the result passed as the first argument to your success callback) are: Thank you. That clears up a lot. But the question that remains is that two different types of data are returned: 1)Script 2)Text The answer may be in the mime type. $()load is so much easier to use. I will research futher. regards tim
[jQuery] Re: Traversing
If you must rely on the markup structure (and you're confident it won't change), then you could use either suggestion (you might want to check for speed), with some minor changes: anytime you find yourself using a selector twice or more ( e.g. .parent().parent().parent() ), then there's most likely a better selector, and you don't need to split the selectors. //first suggestion from above $(this).parents('table').find('table.b').toggle(); //second suggestion from above $(this).parents('tr').next().find('table.b').toggle(); On Feb 18, 8:46 am, Paul Mills paul.f.mi...@gmail.com wrote: Hi, Here are a couple of ways to tackle this. First just using parent(). This traverses up to the outer table and then uses that as the context for selecting table.b : $(table.a).click(function(){ var parent = $(this).parent().parent().parent(); $('table.b', parent).toggle(); }); Second traverses up to the tr and then uses the next tr as the context for selecting tabel.b : $(table.a).click(function(){ var parent = $(this).parents('tr').next(); $('table.b', parent).toggle(); }); Personally, I wouldn't rely on the structure and/or sequence of the HTML to tie the table.a and table.b together. I'd use a class or id attribute to tie them together. Paul On Feb 18, 9:59 am, Turtle3027 becool...@gmail.com wrote: The following HTML is inside a loop, so it can be repeated many times over. table width=600 border=0 cellspacing=0 cellpadding=0 tr tdtable class=atrtd/td/tr/table/td td rowspan='2'nbsp;/td /tr tr tdtable class=btrtd/td/tr/table/td /tr /table I have a click function on table.a All table.b are given hide() How do I show() only the table.b that directly follows the table.a that has been clicked? I have been trying something like: $(table.a).click(function(){ $(this). From here I dont know whether to do parent() or next() or how to move across the tr and td to table.b
[jQuery] default value of an object's property
hi there, a quick question: i'm using an object to pass a series of variables. Sometimes, i test for a specific property, which might not exist. I can't seem to find the right way, i tried Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby=='' ||Obj.sortby == null) ? 'time' : Obj.sortby; but everytime that property sortby hasn't been set, firebug returns it as null can you clear that up for me? Thanks a lot! Alexandre
[jQuery] Re: Order Items. Please help me. Thank You.
Hi, I would like to include the script on the head of the document and using an external JS file. So I inserted it inside the Document.Ready function. I upload a new example showing the problem I have: http://www.27lamps.com/Beta/List/List2.html In this example I didn't use the external JS file. However I placed the code inside the Document.Ready and on the head of the document. When I use the external JS file I copy it just like that to the file and add the include. Anyway, try to add a theme. The first is added but the second not. Or better, I think it is added to the list but not to the page ... Could you tell me what am I doing wrong? Thanks, Miguel On Feb 18, 4:49 pm, mkmanning michaell...@gmail.com wrote: Scripts block other assets from downloading, so the most appropriate place for them (most of the time), is at the close of the body. This allows your page to render, and then allows you to add behavior as progressive enhancement. It's generally good practice; Google progressive enhancement/graceful degradation for more on this. You can still include your script, just include it at the close of the body. Wrap it in a domready function if you like, I usually do that; one consequence of including your scripts at the end of the page is the DOM has been rendered already--which is why mine works :). If you want to keep the script external AND in the head, then you'll have to wrap the code in a domready function. On Feb 18, 8:25 am, shapper mdmo...@gmail.com wrote: Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be serialized if we want to post the data ol = $('#Themes').bind('click',function(e){//event delegation for removing themes, livequery's fine, but this works too e = $(e.target); if(e.is('a')){ var li_index = $(this).children('li').index(e.parents('li')); themes =$.grep(themes, function(n,i){ return (i != li_index); }); buildThemesList(); } return false; }); //Add theme $('#AddTheme').click(function(){ var levels = $('input:checkbox:checked'), subject = $('#Subject').val (), temptheme = []; //validate before we go any further to avoid unnecessary operations if(levels.length==0 || subject == ''){ return false; } //process subject temptheme.push(subject); //process levels var levelCsv = []; //array to hold the levels
[jQuery] Re: Tabs, how to find what kind of object....
The problem is that I can access any element from the iframe to the parent iframe (even the tabs). I can hide tabs div, I can show it, but when i call specific properties on tabs element something goes wrong. I made a simple test case explained here. http://groups.google.com/group/jquery-en/browse_thread/thread/48a38949e6751e4a Unfortunately none answered me. :( Kind regards Massimo On Feb 18, 5:03 pm, Aleem B ale...@gmail.com wrote: I got this problem var $tabs = parent.$('#operativitaframe').contents().find ('#tabsContainer').tabs(); alert($tabs); This prints [object Object]; how can I know if this is the tabs object instead of something else? $tabs is actually a jQuery object. tabs() may add some additional new properties (prevObject, context) but it would be an unreliable to check against those properties as other objects may add similar properties. If you are assigning to $tabs when calling tabs() why would you need to check it again? Calling tabs() again should not be an issue or you could work around it by setting a flag.
[jQuery] Re: Order Items. Please help me. Thank You.
Yes, I tried that to but the problem persists. I updated the new version: http://www.27lamps.com/Beta/List/List2.html I am able to add 1 theme to the list ... Then all the other themes I add are not added to the list ... But I think they are being added to the themes array. The index also does not change ... ... But the index input is on the Html code. I just can't find the problem. Thanks, Miguel On Feb 18, 5:21 pm, mkmanning michaell...@gmail.com wrote: if you're using the ready function, remove the inner (function($) { ... })(jQuery); wrapper On Feb 18, 9:13 am, shapper mdmo...@gmail.com wrote: Hi, I would like to include the script on the head of the document and using an external JS file. So I inserted it inside the Document.Ready function. I upload a new example showing the problem I have: http://www.27lamps.com/Beta/List/List2.html In this example I didn't use the external JS file. However I placed the code inside the Document.Ready and on the head of the document. When I use the external JS file I copy it just like that to the file and add the include. Anyway, try to add a theme. The first is added but the second not. Or better, I think it is added to the list but not to the page ... Could you tell me what am I doing wrong? Thanks, Miguel On Feb 18, 4:49 pm, mkmanning michaell...@gmail.com wrote: Scripts block other assets from downloading, so the most appropriate place for them (most of the time), is at the close of the body. This allows your page to render, and then allows you to add behavior as progressive enhancement. It's generally good practice; Google progressive enhancement/graceful degradation for more on this. You can still include your script, just include it at the close of the body. Wrap it in a domready function if you like, I usually do that; one consequence of including your scripts at the end of the page is the DOM has been rendered already--which is why mine works :). If you want to keep the script external AND in the head, then you'll have to wrap the code in a domready function. On Feb 18, 8:25 am, shapper mdmo...@gmail.com wrote: Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be serialized if we want to post the data ol = $('#Themes').bind('click',function(e){//event delegation for removing themes, livequery's fine, but this works too e = $(e.target); if(e.is('a')){ var li_index = $(this).children('li').index(e.parents('li')); themes =$.grep(themes,
[jQuery] Re: Order Items. Please help me. Thank You.
if you're using the ready function, remove the inner (function($) { ... })(jQuery); wrapper On Feb 18, 9:13 am, shapper mdmo...@gmail.com wrote: Hi, I would like to include the script on the head of the document and using an external JS file. So I inserted it inside the Document.Ready function. I upload a new example showing the problem I have: http://www.27lamps.com/Beta/List/List2.html In this example I didn't use the external JS file. However I placed the code inside the Document.Ready and on the head of the document. When I use the external JS file I copy it just like that to the file and add the include. Anyway, try to add a theme. The first is added but the second not. Or better, I think it is added to the list but not to the page ... Could you tell me what am I doing wrong? Thanks, Miguel On Feb 18, 4:49 pm, mkmanning michaell...@gmail.com wrote: Scripts block other assets from downloading, so the most appropriate place for them (most of the time), is at the close of the body. This allows your page to render, and then allows you to add behavior as progressive enhancement. It's generally good practice; Google progressive enhancement/graceful degradation for more on this. You can still include your script, just include it at the close of the body. Wrap it in a domready function if you like, I usually do that; one consequence of including your scripts at the end of the page is the DOM has been rendered already--which is why mine works :). If you want to keep the script external AND in the head, then you'll have to wrap the code in a domready function. On Feb 18, 8:25 am, shapper mdmo...@gmail.com wrote: Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be serialized if we want to post the data ol = $('#Themes').bind('click',function(e){//event delegation for removing themes, livequery's fine, but this works too e = $(e.target); if(e.is('a')){ var li_index = $(this).children('li').index(e.parents('li')); themes =$.grep(themes, function(n,i){ return (i != li_index); }); buildThemesList(); } return false; }); //Add theme $('#AddTheme').click(function(){ var levels = $('input:checkbox:checked'), subject = $('#Subject').val (), temptheme = []; //validate before we go any further to avoid unnecessary operations if(levels.length==0 || subject == ''){
[jQuery] Re: Order Items. Please help me. Thank You.
The problem is with the version of jQuery you're using. Update to 1.3 (and don't include a space in the URI). Try your code with the Google js api and it will work (I just did, even with the duplicate jQuery wrapper functions). On Feb 18, 9:28 am, shapper mdmo...@gmail.com wrote: Yes, I tried that to but the problem persists. I updated the new version:http://www.27lamps.com/Beta/List/List2.html I am able to add 1 theme to the list ... Then all the other themes I add are not added to the list ... But I think they are being added to the themes array. The index also does not change ... ... But the index input is on the Html code. I just can't find the problem. Thanks, Miguel On Feb 18, 5:21 pm, mkmanning michaell...@gmail.com wrote: if you're using the ready function, remove the inner (function($) { ... })(jQuery); wrapper On Feb 18, 9:13 am, shapper mdmo...@gmail.com wrote: Hi, I would like to include the script on the head of the document and using an external JS file. So I inserted it inside the Document.Ready function. I upload a new example showing the problem I have: http://www.27lamps.com/Beta/List/List2.html In this example I didn't use the external JS file. However I placed the code inside the Document.Ready and on the head of the document. When I use the external JS file I copy it just like that to the file and add the include. Anyway, try to add a theme. The first is added but the second not. Or better, I think it is added to the list but not to the page ... Could you tell me what am I doing wrong? Thanks, Miguel On Feb 18, 4:49 pm, mkmanning michaell...@gmail.com wrote: Scripts block other assets from downloading, so the most appropriate place for them (most of the time), is at the close of the body. This allows your page to render, and then allows you to add behavior as progressive enhancement. It's generally good practice; Google progressive enhancement/graceful degradation for more on this. You can still include your script, just include it at the close of the body. Wrap it in a domready function if you like, I usually do that; one consequence of including your scripts at the end of the page is the DOM has been rendered already--which is why mine works :). If you want to keep the script external AND in the head, then you'll have to wrap the code in a domready function. On Feb 18, 8:25 am, shapper mdmo...@gmail.com wrote: Hi, I was trying to integrate your code on my web application and the following happens: I am able to add a theme. But when I try to add a second theme I get the following error: [Exception... 'type property can't be changed' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] data()()JQuery-1.2.6.js (line 696) remove()()JQuery-1.2.6.js (line 1929) (?)()()JQuery-1.2.6.js (line 1330) each()()JQuery-1.2.6.js (line 762) each()()JQuery-1.2.6.js (line 155) remove()()JQuery-1.2.6.js (line 1329) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) empty()()JQuery-1.2.6.js (line 1340) each()()JQuery-1.2.6.js (line 751) each()()JQuery-1.2.6.js (line 155) (?)()()JQuery-1.2.6.js (line 1348) (?)()()JQuery.L...-1.0.3.js (line 178) buildThemesList()Create (line 453) (?)()()Create (line 450) handle()()JQuery-1.2.6.js (line 2093) (?)()()JQuery-1.2.6.js (line 1875) [Break on this error] jQuery.cache[ id ][ name ] : Any idea why? And a few questions: 1. Shouldn't I place the code inside Document.Ready? I followed your example and didn't place it inside it but I don't understand why ... 2. Why do you place the script after the body? I am placing the script inside a js file and then I include it in the head of the document. Thanks, Miguel On Feb 18, 7:13 am, mkmanning michaell...@gmail.com wrote: Here's a wholly different approach for consideration. Rather than try and keep track of LI elements and regex their names with the current index, just use an array placeholder and rebuild the list. Chances are if the user is required to add items, the list isn't going to get unmanageably huge (at least I'd hope not from a usability standpoint). Below is a refactored example, and you can see it live here:http://actingthemaggot.com/test/add_theme.html Refactored (uses markup fromhttp://www.27lamps.com/Beta/List/List.html): (function($) { var themes = [], //this will be an array of arrays to keep track, we can use its indexing to rebuild the themes list, and it can be
[jQuery] Re: Javascript Generated by $()load does not render
On Wednesday 18 February 2009, Alexandre Plennevaux wrote: you can use load, you just have to setup the ajaxSetup controlling your ajax main parameters so you set it to your liking, then you call the load(). It is built on top of the ajax method to ease its use. See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options I am looking at: http://docs.jquery.com/Types#Options in addition I am looking at printed material I see from the book: jQuery In Action - page 252 documentation for $.ajaxSetup(properties). The properties object can contain a dataType value. 1)What datatype value would configure $load so that it would handle both script and html. IOWS the CGI script returns both javascript and html? 2)Are these datatype strings themselves case sensitive. Time is limited for me right now, I'll do my home work a little later. :-) thanks again
[jQuery] Re: image rollover
Thanks guys. I'll test these out. Will post the results soon. On Feb 18, 11:43 am, mkmanning michaell...@gmail.com wrote: You can take a slightly different approach, which might simplify your markup, css and js. Since you're using absolute positioning, you can absolutely position your image over your text, then just toggle the opacity on hover to reveal the text underneath. One advantage with this approach is you're always 'over' the image, so there's no issue of which element has focus and thus firing the mouseout. Here's the markup: ul li class=episode pText to be shown on mouse over/p img src=/images/image1.jpg/ /li li class=episode pText to be shown on mouse over/p img src=/images/image2.jpg/ /li /ul Here's the CSS (you'll also need to size the LI's width and height to the image size): li.episode{ position:relative;} li.episode img{ position:absolute; top:0; left:0;} li.episode img.trans{ opacity: .15; /* Standard: FF gt 1.5, Opera, Safari */ filter: alpha(opacity=15); /* IE lt 8 */ -ms-filter: alpha(opacity=15); /* IE 8 */ -khtml-opacity: .15; /* Safari 1.x */ -moz-opacity: .15; /* FF lt 1.5, Netscape */ } Here's the js: $('.episode img').hover( function(){ $(this).addClass('trans'); }, function(){ $(this).removeClass('trans'); } ); Btw, you don't need display:block on a div, it's a block level element. On Feb 18, 6:20 am, Leonardo K leo...@gmail.com wrote: Assign the event to the element li and not the image. Because if you display a text over the image, you will lose the event mouseover. $(document).ready(function() { $(li.episode).mouseover(function () { $(this).addClass(background); $('div.details').addClass(show); }); $(li.episode).mouseout(function () { $(this).removeClass(background); $('.details').removeClass(show); }); });- Hide quoted text - - Show quoted text -
[jQuery] Re: Using jQuery.noConflict() with Prototype/Scriptaculous
I find it more practical to use an anonymous function as in (function ($){..}(jQuery) and keep the '$' reference, or do all the work at once to avoid confusion: (function($){ $(...) })( jQuery.noConflict() ) or jQuery.noConflict()(function($){ $(...) }); On Jan 7, 4:55 am, seasoup seas...@gmail.com wrote: noConflict was designed specifically with prototype in mind :) The easiest way to do both jQuery and proto is to do: var $j = jQuery.noConflict(); and use $j instead of $ for jQuery. $j('#id'), for example. On Jan 6, 10:23 pm, Magnificent imightbewrongbutidontthin...@gmail.com wrote: Hi Erik, thanks for the reply. I've been messing with things and I tried replacing my calls to local versions of prototype/scriptaculous to use google: script src=http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/ prototype.js type=text/javascript/script script src=http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/ scriptaculous.js type=text/javascript/script And it seems to be working now. Does anyone know if there's a known issue using jquery's noConflict() with prototype/scriptaculous? I'm wondering if the (older) local version I was using was the culprit. It looks like it.
[jQuery] Require a specific radio button to be selected - Validation plugin
I have a terms of use agreement on my site and I would like to provide radio buttons with labels of I Agree and I Disagree. If the user selects I Disagree then I'd like a message saying something like Sorry, you must agree to the terms and conditions before proceeding and if the user selects Agree then allow them to continue. I can set these fields to be required with the JQuery validation plugin bit I am at a loss as to how I can require a specific value to be selected. Any help will be greatly appreciated.
[jQuery] Horizontal Scroll Bar appearing for some reason
Hi, I am trying to implement your horizontal nav bar into a design I am creating but for some reason it's adding a horizontal scroll bar on the screen even though the page itself and the nave are much smaller than the width of the screen. any help would be appreciated!
[jQuery] Safari says Invalid Date object from dpGetSelected() in datePicker v2
Hi All, I'm using Kelvin Luck's brilliant datepicker plugin (http:// www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html) and am having a strange issue in Safari Version 3.2.1 (5525.27.1). I'm running a couple simple lines of my own code that are bound to the calendar's dateSelected event that fires any time a date is clicked on the calendar. The first line below simply captures the currently selected date from the calendar as a standard JavaScript Date object using the datePicker plugin's dpGetSelected() method. It stores that Date object in a variable named myDate1: myDate1 = new Date( $('#calendar1').dpGetSelected() ); Then, I use that myDate1 variable to render a textual representation of the selected date to a separate element on the page with this line: $('#dateDisplay').html( myDate1.getMonthName(true) + ' ' + myDate1.getDate() + ', ' + myDate1.getFullYear() ); Which attempts to renders some text like: Jan 14, 2009 This all works perfectly in Firefox, but Safari thinks that the Date object (myDate1) is invalid for some reason. For testing, I printed out the Date object in Firebug and it looks just like any other perfectly valid date object. Firefox considers it valid. So I don't know what Safari's problem is with the Date object returned by the datePicker plugin's dpGetSelected() method. Has anyone else ever seen any Date object errors like this in Safari and could perhaps share any insights? The same problem also occurs in the latest Webkit nightly build. Thanks!
[jQuery] Superfish - Horizontal Scroll Bar appearing for some reason
Hi, I am trying to implement your horizontal nav bar into a design I am creating but for some reason it's adding a horizontal scroll bar on the screen even though the page itself and the nave are much smaller than the width of the screen. any help would be appreciated! Here is a link to the css files. http://dev2.azaz.com/scott/ahno/css/superfish.css http://dev2.azaz.com/scott/ahno/css/superfish-navbar.css
[jQuery] jquery.listnav
I have an index page with 1270 list items being processed by listnav, and loading the page takes about 15 seconds. Without listnav turned on, the page loads in less than a second. Is there a way to speed up the indexing through caching? Or a setting that would use pre-populated LI classes?
[jQuery] tagging plugin
I need to implement a tagging keyword solution for my application in ColdFusion. I am looking for a tagging solution like the one found in Drupal that is a type ahead and you can select words and the words are added in a comma delimited list. Does anyone know where I might find a solution like this?
[jQuery] ClueTip - positionBy:'fixed' in FF3
Howdy, I'm seeing something I never thought I'd see- positioning works correctly in IE and not in FF (as far as I can tell)! I'm attempting to use positionBy:'fixed' because I want the tip to appear in the same position relative to the referring link.The links are large thumbnails, and I'm using jCarousel. Basically I'm looking for the tip to appear overlapping the top right corner of each image. I've switched the insertionElement to .jcarousel-container- horizontal, and have a leftOffset of -100. This works fine when I don't have anything cached- the tip appears where I'd expect it to. However, refreshing the page without clearing the cache adds lots of pixels to the css left property. For instance, the first time I load the page div id=cluetip has a left property of 169px. If I refresh without clearing the cache, this jumps to 370px. This occurs with every referring link on the page, and occurs regardless of the value set for leftOffset (even with 0 or the default 15). Thanks, John
[jQuery] Re: Extending a plugin
I ran into this myself a couple of times. The jQuery framework leaves much to be desired in this arena and there is considerable lack of proper OO inheritance from what I am aware of (I have only been on jQuery for 2-3 weeks). I recently tried to extend the ui.spinner JavaScript is no different than any other language - you can't override things that are private. jQuery proper actually exposes nearly everything for you to override and also has many explicit extension points (fn, easing, speed, etc). Plugins often don't offer the same extensibility, but that has nothing to do with jQuery's design.
[jQuery] Re: Creating callbacks using Cycle plugin
div id=frame1img src= alt= title= /img src= /alt = title= //div a id=prev2 href=#Prev/a a id=next2 href=#Next/a and I assign each image's alt and/or title, how can I evoke them as captions below each image after clicking prev/next? Hmm, should be pretty easy for that setup. Assuming you have a #caption element somewhere: $('#frame1').cycle({ prev: '#prev', next: '#next', before: function() { $('#caption').html(this.alt); } });
[jQuery] Re: Superfish - Horizontal Scroll Bar appearing for some reason
I've manged to make it go away in Firefox by adding 'overflow- x:hidden' too my css but that will not work in IE 6 and later. this is for a client who as we all know client means IE user(ha) so It's pretty important I get it to go away. Thanks! If you need more links let me know. On Feb 18, 8:33 am, Skedoozy skedo...@gmail.com wrote: Hi, I am trying to implement your horizontal nav bar into a design I am creating but for some reason it's adding a horizontal scroll bar on the screen even though the page itself and the nave are much smaller than the width of the screen. any help would be appreciated! Here is a link to the css files. http://dev2.azaz.com/scott/ahno/css/superfish.csshttp://dev2.azaz.com/scott/ahno/css/superfish-navbar.css
[jQuery] jquery and the accents
[jquery-1.1.3.js] client-side: I have a form with text field and file field.+ iso-8859-1 transmission by ajax to the server server-side: I have a var_dump($_POST); First test I enter in one text field the string rené : the dump gives rené Second test I enter in one text field the string rené and in the file field logo.gif : the dump gives rené That means that jquery changes somewhere the charset ? How can I manage that cleanly ?
[jQuery] Re: Require a specific radio button to be selected - Validation plugin
How about just a required checkbox? [ ] I agree to terms of use Jörn On Wed, Feb 18, 2009 at 5:51 PM, Gigi gig...@gmail.com wrote: I have a terms of use agreement on my site and I would like to provide radio buttons with labels of I Agree and I Disagree. If the user selects I Disagree then I'd like a message saying something like Sorry, you must agree to the terms and conditions before proceeding and if the user selects Agree then allow them to continue. I can set these fields to be required with the JQuery validation plugin bit I am at a loss as to how I can require a specific value to be selected. Any help will be greatly appreciated.
[jQuery] Element Name Selector Syntax Troubles
Currently building a shipping calculator and attempting to add in a section that checks every shopping cart item's quantity and then multiplies that quantity by the weight of that item. The HMTL consists of input fields similar to the example below: input type=hidden name=quantity1 value=1 / input type=hidden name=weight1 value=3.1 / input type=hidden name=quantity2 value=3 / input type=hidden name=weight2 value=2.1 / The way I designed the following portion of my script is it finds all input elements with a name containing quantity. If it is equal to or greater than 2 it will first assign a variable with the quantity value, then find the corresponding weight input field and pull the weight value from that. Then it will multiply those together and then change the weight value to the new one. $(input[name*='quantity']).each(function(i) { if ((Number($(this).val())) = 2) { multiplier = (Number($(this).val())); weight = Number($(input[name=('weight' + (i))]).val()); multipliedweight = (weight) * (multiplier); $(input[name=('weight' + (i))]).val(multipliedweight); } }); The first part where it gets the multiplier works and returns correct values. The second two parts return NaN. I'm assuming I have my syntax incorrect on the weight variable. Thanks for taking a look and I hope someone can point me in the right direction!
[jQuery] Re: selector best practice
Your test case is not comparing a raw implementation You are still using jQuery $ inside the loop, it should be pure document.getElementById(test); When you remove the $ from your test case and use native implementation you will be getting numbers in the following range: FF ID Raw: 1 ID jQuery: 17 Class Raw: 1 Class jQuery: 495 Safari ID Raw: 1 ID jQuery: 5 Class Raw: 1 Class jQuery: 228 var idNormal = (new Date).getTime() - idStart; idStart = (new Date).getTime(); for ( var i = 0; i 500; i++ ) { document.getElementById(test); } var idRaw = (new Date).getTime() - idStart; var cNormal = (new Date).getTime() - cStart; cStart = (new Date).getTime(); for ( var i = 0; i 100; i++ ) { document.getElementsByClassName(test); } On Feb 16, 8:43 am, John Resig jere...@gmail.com wrote: Umm - that's not true at all. I created a test for you to see:http://dev.jquery.com/~john/ticket/class-speed/ In Firefox 3 I'm getting: ID Raw: 9 ID jQuery: 22 (over 500 queries) Class Raw: 1108 Class jQuery: 778 (over 100 queries) In Safari 3.2 I'm getting: ID Raw: 1 ID jQuery: 3 (over 500 queries) Class Raw: 224 Class jQuery: 184 (over 100 queries) So not only is jQuery's class implementation faster but the ID searching has an approximately 0.026 milliseconds overhead - that's 2.6% of 1 millisecond per query - an absolutely acceptable figure to be able to live with. --John On Mon, Feb 16, 2009 at 8:28 AM, RobG rg...@iinet.net.au wrote: On Feb 16, 5:30 pm, SteelRing steelr...@gmail.com wrote: This may sound stupid to y'all jquery practitioners, but i wonder which method is fastest (recommended) for selecting a cell with a class in a big table (think like 1000+ rows 100+ columns): Fastest: the browser-native getElementsByClassName (recent Firefox, Opera, Safari) is 20 to 40 times faster than $('.className'), as a bonus you get a live collection. Alternatively, XPath is probably just as quick but the result isn't live (supported by the same set of browsers). The jQuery way is to use a CSS selector, however it is much slower than other methods (except perhaps in IE). (#tableid tbody tr.rowclass td.cellclass) or is it (td.cellclass) or (.cellclass). And how about if the cell happens to have a unique id: (#tableid tbody tr#uniquerow td#uniqueid) or just (#uniqueid) If speed really matters, getElementById is more than 7 times faster than $('#...') in Firefox and 4 times faster in Safari. Philosophically, the question being is it better to put as much detail as structurally already known by the programmer into the selector or just anything goes and let jquery handle it as long as it works. There is no selector optimisation that I can see in jQuery other than using getElementById after discovering '#...' (and the overhead of discovering that means it is 4 to 6 times slower than gEBI). As a general rule, keep the selector to a minimum that concisely describes the element - cells must be inside table, table section and row elements, including those in a selector doesn't seem to help. An ID for the starting selector likely does. Do some testing for particular circumstances, the most efficient method will emerge. Don't forget to include browser-native methods where available. -- Rob
[jQuery] Re: tagging plugin
I just together a quick tagger plugin the other day that might help you. You can check out the demo here: http://www.virgentech.com/code/tagger On 2/18/09, murphyhg murph...@gmail.com wrote: I need to implement a tagging keyword solution for my application in ColdFusion. I am looking for a tagging solution like the one found in Drupal that is a type ahead and you can select words and the words are added in a comma delimited list. Does anyone know where I might find a solution like this? -- -Hector
[jQuery] Re: default value of an object's property
I think this might work, give it a try: Obj.sortby = Obj.sortby || 'time'; -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux Sent: Wednesday, February 18, 2009 9:07 AM To: Jquery-en Subject: [jQuery] default value of an object's property hi there, a quick question: i'm using an object to pass a series of variables. Sometimes, i test for a specific property, which might not exist. I can't seem to find the right way, i tried Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby=='' ||Obj.sortby == null) ? 'time' : Obj.sortby; but everytime that property sortby hasn't been set, firebug returns it as null can you clear that up for me? Thanks a lot! Alexandre
[jQuery] Re: jquery and the accents
I've never had any issues with charset and jquery. You should probably set your charset (META) on your page to utf-8. On Feb 18, 8:27 am, phicarre gam...@bluewin.ch wrote: [jquery-1.1.3.js] client-side: I have a form with text field and file field. + iso-8859-1 transmission by ajax to the server server-side: I have a var_dump($_POST); First test I enter in one text field the string rené : the dump gives rené Second test I enter in one text field the string rené and in the file field logo.gif : the dump gives rené That means that jquery changes somewhere the charset ? How can I manage that cleanly ?
[jQuery] Re: Superfish - Horizontal Scroll Bar appearing for some reason
can you post a test page? it's a lot easier to troubleshoot with a test page and Firebug.
[jQuery] Re: Element Name Selector Syntax Troubles
weight = Number($(input[name=('weight' + (i))]).val()); Why do you have ()'s around the weight part (and the i as well for that matter)? weight = Number($(input[name='weight + i']).val()); should work (note to copy and paste that because it's hard to see difference between single and double quotes On Feb 18, 1:35 pm, Zaliek zali...@gmail.com wrote: Currently building a shipping calculator and attempting to add in a section that checks every shopping cart item's quantity and then multiplies that quantity by the weight of that item. The HMTL consists of input fields similar to the example below: input type=hidden name=quantity1 value=1 / input type=hidden name=weight1 value=3.1 / input type=hidden name=quantity2 value=3 / input type=hidden name=weight2 value=2.1 / The way I designed the following portion of my script is it finds all input elements with a name containing quantity. If it is equal to or greater than 2 it will first assign a variable with the quantity value, then find the corresponding weight input field and pull the weight value from that. Then it will multiply those together and then change the weight value to the new one. $(input[name*='quantity']).each(function(i) { if ((Number($(this).val())) = 2) { multiplier = (Number($(this).val())); weight = Number($(input[name=('weight' + (i))]).val()); multipliedweight = (weight) * (multiplier); $(input[name=('weight' + (i))]).val(multipliedweight); } }); The first part where it gets the multiplier works and returns correct values. The second two parts return NaN. I'm assuming I have my syntax incorrect on the weight variable. Thanks for taking a look and I hope someone can point me in the right direction!
[jQuery] Re: Extending a plugin
On Feb 18, 7:01 am, Mike Alsup mal...@gmail.com wrote: I guess it depends what you want to change. Using extend you can redefine any of the public functions, but the private functions will remain private. I've found that many plugins simply aren't that extensible. This is very bad design, IMO. Only in the simplest cases are plugins a perfect fit for someone's needs. I've ripped apart plugins before because I liked some of what was there, but it didn't allow enough extensibility to allow me to do what I want in the context of a specific web app. In my opinion, there is no need for ANY method in a plugin to be private. Doing so is saying that the author knows all possible uses for the code, and they can be certain that no one will ever want to do anything differently than how they wrote it. There is simply no reason to make anything private. Expose everything. Just in case. Also, many plugins have long methods that perform a bunch of logic, rather than splitting it into multiple functions that can be easily over-ridden and customized. I had to fix a problem with BlockUI a while ago and was disappointed that I had to over-ride a huge function and copy all the logic in it to change one single line. Bad design. I've written a context menu plugin that I think has a better framework: http://www.javascripttoolbox.com/lib/contextmenu/ http://plugins.jquery.com/project/cmenu In this plugin (written partly as an educational exercise) I have tried to separate code functionality into logical pieces, and allow _everything_ to be extensible by the user. This allows greater freedom and flexibility, and I've already seen the code used in ways I hadn't imagined when I wrote it. I am of course open to any suggestions or critiques. Plugins, IMO, seem to be the weakest link when implemting jQuery, and it would be great if there were some better models and guidelines for plugin development that would make the end results better for everyone. Matt Kruse
[jQuery] Re: 1.3.1 Bogs down on table parsing
The issue that I am having with doing it that way is that the hover action is only triggered when a person mouses over the table. You can move all around the table, but it won't trigger again until the mouse is moved off and then back on the table. I need the over to be triggered for every row. Is there a way to get around this? On Feb 17, 2:52 pm, James james.gp@gmail.com wrote: It seems you're still binding several events to every tr and not using event delegation. Your goal is to make events like click and hover attached to the table instead of on each row, such that your very top-level statements look like: $(table).click(function() {}); $(table).hover( function() {}, function() {} ); -- 2 events attached (well, technically it's 3, since hover is onmouseover and onmouseout) Rather than: $('table').find('tr').each( $(row).click(function() {}); $(row).hover(...); ); -- 2 x #ofRows events attached (640 events attached, if you have 320 rows) When you use event delegation, you bind a click on the table itself. When a user clicks anywhere on the table, you act on what was clicked. When a user clicks on a table, it'll most likely be a td that they clicked on. event.target will give you reference to that element. So if you use, something like: tr = $(event.target).parent(); you can get the tr that the clicked td is in. Then you can do something with the tr, such as getting the ID of it. myID = tr.attr(id); On Feb 16, 9:58 am, zenbaida zenba...@gmail.com wrote: OK, I rewrote the code, and the page loads a lot faster, but I ran into another problem. Now the performance of the script slows down as the length of the table increases. As I hover over a cell in the above table that triggers the event, it may take a half second or so to trigger. I tested the same script with version 1.2.6, and there is no delay issue. Here is the new code: function setDetail() { $('.detailShowIcon').hide(); // hide all of the detail show icons $('.detailShowIcon').parent().addClass('arrowHidden').css ({width:'20px', height:'18px'}); $('#subject .row').after('div id=hoverPrintercode/code/ div'); // for the arrow detail toggles $('table').find('tr').each(function(i) { var rowId = $(this).attr('id'); if(rowId !rowId.match('detail')) { var hoverArea = '#' + rowId + + 'td#arrow-' + rowId; $(hoverArea).click(function(event) { var thisParent = $(this).parent().attr('id'); var imageRow = '#' + thisParent; var detailDiv = '#detail-' + thisParent; //alert($(event.target).is(imageCellDiv)); if($(imageRow).attr('class') == 'text2') { $(imageRow).attr('class','text4'); $(detailDiv).hide(); } else { $(imageRow).attr('class','text2'); $(detailDiv).show(); } setFooter(); // re-calculate the footer possition }); $(hoverArea).hover(function(event) { var imageRow = '#' + $(this).parent().attr('id'); var imageCellDiv = '#' + $(this).attr('id') + ' div'; if($(imageRow).attr('class') != 'text2') { $(imageRow).attr('class','text4'); $(imageCellDiv).removeClass('arrowHidden'); } else { $(imageCellDiv).removeClass('arrowShow'); } $(imageCellDiv).addClass('arrowActive'); }, function(event) { var imageRow = '#' + $(this).parent().attr('id'); var imageCellDiv = '#' + $(this).attr('id') + ' div'; if($(imageRow).attr('class') != 'text2') { $(imageRow).attr('class','text3'); $(imageCellDiv).removeClass('arrowActive');
[jQuery] Re: insert div into group ordered by ID..
I've since updated the script by request, it failed if you began with a single element in the container. It now sorts by any attribute you want (ids by default) and works with multiple elements both ways. http://ff6600.org/j/jquery.insertInOrder.js Examples at: http://jsbin.com/itofi http://jsbin.com/itofi/edit (source) cheers, - ricardo On 22 dez 2008, 15:54, Tbone 95dak...@gmail.com wrote: Thanks to you, too, ksunBetween you and Ricardo, I think I understand this now! On Dec 22, 11:42 am, ksun kavi.sunda...@gmail.com wrote: //locate thedivbefore which you want toinsertand theninsert, assuming they are ordered alphabetically $('div[id]').each(function(){ if ($(this).attr('id') 'delta') $(this).before('divid=delta/'); }); I think there is no selector that will do the same, but I may be wrong. On Dec 22, 12:32 pm, Tbone 95dak...@gmail.com wrote: Great! Thanks... However, I'm more clueless than I should be...and didn't pose the complete question... I have the divs as shown above, how do I locate where div id=delta/div would go? Obviously between gamma and epsilon, but I need to search the ids for the first (id delta). Then I can use yourinsertto properly place it. I assume I use a selector, but am not sure how to put it together. On Dec 22, 10:25 am, ksun kavi.sunda...@gmail.com wrote: try this, it willinsertgamma1 before epsilon. $('#gamma~#epsilon').before('divid=gamma1/'); I first used after(), but that didn't work, looks like $ ('#gamma~#epsilon') selects #epsilon.- Hide quoted text - - Show quoted text -
[jQuery] Re: A question for John Resig
Matt, While it would not affect the results, I believe you can shave a few ms off by using === On Feb 18, 11:26 am, Matt Kruse m...@thekrusefamily.com wrote: On Feb 18, 6:57 am, John Resig jere...@gmail.com wrote: typeof FOO === string typeof FOO === number typeof FOO === boolean == is sufficient. typeof always returns a string. Matt Kruse
[jQuery] Re: A question for John Resig
On Feb 18, 2:20 pm, Kean shenan...@gmail.com wrote: While it would not affect the results, I believe you can shave a few ms off by using === Over 10,000,000 iterations, I see no difference in time between using == and ===. If the return type of 'typeof' varied, a difference might be found. It's just a minor quibble anyway. It's similar to lines like this in the jquery source: if ( typeof text !== object text != null ) Fixing things like this would tighten and improve the code a bit, IMO. Matt Kruse
[jQuery] Selector Efficiency?
So... a question regarding selector efficiency. The following snippet of HTML describes attributes associated with a polygon in an KML. Its basically a table of data, contained as spans in lis in a ul. Given this snippet, what would be the best (fastest) way to return the values of MAP_ID and SITE_ADDRESS foo = h4GISDATA.ASSESSPARNC_POLY_PUBLIC/h4 ul class=textattributes listrongspan class=atr-nameMAP_ID/span:/strong span class=atr-value16-27/span/li listrongspan class=atr-nameSITE_ADDRESS/span:/strong span class=atr-value396 Main St/span/li listrongspan class=atr-nameSITE_OTHER_FIELD/span:/strong span class=atr-valueGrat Data/span/li listrongspan class=atr-nameUSE_CODE/span:/strong span class=atr-value101/span/li listrongspan class=atr-nameTOWN_ID/span:/strong span class=atr-value116/span/li listrongspan class=atr-nameWARREN_GROUP_05_MAP_ID/span:/strong span class=atr-valueM:0016 B: L:0027/span/li listrongspan class=atr-nameACRES/span:/strong span class=atr-value0.67102373655/span/li /ul The following works parcelOutput = 'Parcel ID: ' + jQuery(foo).find('li:contains(MAP_)').not('li:contains(WARREN_GROUP)').children('.atr-value').text() + 'br' + 'Address: ' + jQuery(foo).find('li:contains(SITE_ADDRESS)').children('.atr-value').text(); Is there a better/more efficient way to return these values? Thanks!