Re: [jQuery] Enhancements to Imagebox
Janet Weber wrote: Hi Tobbe I was wandering if you noticed that the loading.gif graphic dosen't have a transparent background? Hm...yes, when you mention it :-) So how do I make its background transparent? I'm no good at doing graphics like that. Cheers, Tobbe Janet -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Torbjorn Tornkvist Sent: Thursday, March 01, 2007 8:14 PM To: discuss@jquery.com Subject: [jQuery] Enhancements to Imagebox Hi, I've done some enhancements to Imagebox that may be of general interest. Added: + a stop() function that undo what init() does. + a closeHook option that is called when Imagebox is closed. + a nextImage2 and prevImage2 element that are placed to the left of closeHTML I'm not sure what the process is when contributing code but the code can be found here (for a while): http://noneg.tornkvist.org:8080/js/imagebox.js It is based on what I checked out from svn some hours ago. For an example of the new functionality, see: http://noneg.tornkvist.org:8080/search.yaws?adonly=falseaction=keywordke y=barcelona Click on the link named: Bildspel at the top. Cheers, Tobbe ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How to block a function while another finishes?
I'm having a hard time getting functions to happen in the order I want them to. Specifically, I need the html of a div to be rewritten BEFORE it slides back down. I'm seeing the html change while the div is sliding up, which isn't what I'm looking for. Is there any way to force functions to finish before moving on? Synchronous-style... -a div on the page is assigned to divTarget, and I'm positive it's finding the correct one) -stuff holds the results of an ajax query: some basic HTML. $(divTarget).slideUp(slow); $(divTarget).children(div.middle).html(stuff); $(divTarget).slideDown(slow); *note: I know I could chain these, but am trying to get it to work first before fiddling with that ;) thanks, -kim Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony
David - I think the catch was the very last item that was mentioned on the page: Grouping all inline JS snippets into a single file. That's what makes the plugin all worth it. --John On 3/2/07, David Duymelinck [EMAIL PROTECTED] wrote: François Zaninotto schreef: I'm not sure I get you... All the helpers described in the blog post are bundled with the plugin. Or do you mean something else? Why would you need to have a function that writes inline javascript code if the whole idea of the plugin is to generate unobtrusive javascript. I'm talking about the UJS_write function to be exact. http://www.symfony-project.com/trac/wiki/sfUJSPlugin#Addingsomecontentunobtrusively It is this example that confused me. ?php UJS_write('a href=# onclick=$(\'#foobar\').toggle();return false;click me/a') ? Isn't it better to write it as ?php UJS_write('a href=# class=toggleclick me/a'); UJS_add_behaviour('a.toggle', 'click', $('#foobar').toggle();return false;); ? If you go unobtrusive go unobtrusive all the way :) Once i get around to learning how to use symfony i will definitively give your helper a try. I bet this will amaze my more code challenged colleagues :) -- David Duymelinck [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] [FYI] fine Tool used JQuery
Hi all, have a look: http://www.riddle.pl/emcalc/ tool for fontsize in em to view in px -- Viele Grüße, Olaf --- [EMAIL PROTECTED] http://olaf-bosch.de www.akitafreund.de --- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Enhancements to Imagebox
Torbjorn Tornkvist wrote: Janet Weber wrote: Hi Tobbe I was wandering if you noticed that the loading.gif graphic dosen't have a transparent background? Hm...yes, when you mention it :-) So how do I make its background transparent? I'm no good at doing graphics like that. I'm stupid too...it is the div container that gives the white background. Setting its background transparent doesn't solve the problem since then the 'border' also become transparent. I'll have to think about that. Cheers, Tobbe Cheers, Tobbe Janet -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Torbjorn Tornkvist Sent: Thursday, March 01, 2007 8:14 PM To: discuss@jquery.com Subject: [jQuery] Enhancements to Imagebox Hi, I've done some enhancements to Imagebox that may be of general interest. Added: + a stop() function that undo what init() does. + a closeHook option that is called when Imagebox is closed. + a nextImage2 and prevImage2 element that are placed to the left of closeHTML I'm not sure what the process is when contributing code but the code can be found here (for a while): http://noneg.tornkvist.org:8080/js/imagebox.js It is based on what I checked out from svn some hours ago. For an example of the new functionality, see: http://noneg.tornkvist.org:8080/search.yaws?adonly=falseaction=keywordke y=barcelona Click on the link named: Bildspel at the top. Cheers, Tobbe ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony
Yes, that is exactly that. All calls to UJS helpers feed a buffer and the code doesn't appear directly in the page. But the page includes a JavaScript file, in which the buffered code is written. Therefore, all code included in a UJS call is separated from the content, even if, for the developer, it appears inside the template code. Francois -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de John Resig Envoyé : vendredi 2 mars 2007 09:17 À : jQuery Discussion. Objet : Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony David - I think the catch was the very last item that was mentioned on the page: Grouping all inline JS snippets into a single file. That's what makes the plugin all worth it. --John On 3/2/07, David Duymelinck [EMAIL PROTECTED] wrote: François Zaninotto schreef: I'm not sure I get you... All the helpers described in the blog post are bundled with the plugin. Or do you mean something else? Why would you need to have a function that writes inline javascript code if the whole idea of the plugin is to generate unobtrusive javascript. I'm talking about the UJS_write function to be exact. http://www.symfony-project.com/trac/wiki/sfUJSPlugin#Addingsomecontent unobtrusively It is this example that confused me. ?php UJS_write('a href=# onclick=$(\'#foobar\').toggle();return false;click me/a') ? Isn't it better to write it as ?php UJS_write('a href=# class=toggleclick me/a'); UJS_add_behaviour('a.toggle', 'click', $('#foobar').toggle();return false;); ? If you go unobtrusive go unobtrusive all the way :) Once i get around to learning how to use symfony i will definitively give your helper a try. I bet this will amaze my more code challenged colleagues :) -- David Duymelinck [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to block a function while another finishes?
The effect methods in jQuery take an optional callback parameter. The callback function is called when the animation is complete. So you can do: $divTarget = $(divTarget); $divTarget.slideUp(slow, function() { $divTarget.children(div.middle).html(stuff); $divTarget.slideDown(slow); }); ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony
François Zaninotto schreef: Yes, that is exactly that. All calls to UJS helpers feed a buffer and the code doesn't appear directly in the page. But the page includes a JavaScript file, in which the buffered code is written. Therefore, all code included in a UJS call is separated from the content, even if, for the developer, it appears inside the template code. Francois -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de John Resig Envoyé : vendredi 2 mars 2007 09:17 À : jQuery Discussion. Objet : Re: [jQuery] Announce: Unobtrusive JavaScript with jQuery andsymfony David - I think the catch was the very last item that was mentioned on the page: Grouping all inline JS snippets into a single file. That's what makes the plugin all worth it. That is great, thanks for having patients with me. it wasn't clear to me how it all comes together. -- David Duymelinck [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to block a function while another finishes?
Kim Johnson schrieb: I'm having a hard time getting functions to happen in the order I want them to. Specifically, I need the html of a div to be rewritten BEFORE it slides back down. I'm seeing the html change while the div is sliding up, which isn't what I'm looking for. Is there any way to force functions to finish before moving on? Synchronous-style... -a div on the page is assigned to divTarget, and I'm positive it's finding the correct one) -stuff holds the results of an ajax query: some basic HTML. $(divTarget).slideUp(slow); $(divTarget).children(div.middle).html(stuff); $(divTarget).slideDown(slow); *note: I know I could chain these, but am trying to get it to work first before fiddling with that ;) thanks, -kim You have to use callbacks which are provided for all of the animate functions: var target = $(divTarget); target.slideUp(slow, function() { target.children(div.middle).html(stuff); target.slideDown(slow); }); I've saved the target in a variable to avoid creating a jQuery object 3 times. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] :first selector perofmance question
Brice Burgess schrieb: John Resig wrote: Unfortunately, not in any way that is universally practical. The div:first query is obviously improvable, but when you get into queries like [EMAIL PROTECTED] it becomes a lot less clear. I'll think about improving TAG:first/last - as that seems like a common case, at least. I see what you're saying. It is too bad there is no native DOM selector that supports an SQL like clause with LIMIT, ORDER BY, and of course compundable attribute LIKE support :) .. what would we need jQuery for then though? ;( It's in the works: http://www.w3.org/TR/selectors-api/ But that will take another few years I think. Until then we're lucky to have jQuery. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1.2
Thanks for valuable info! But these aren't really attributes, at least in the HTML sense. They're what I call custom properties, and a central plank of object-oriented javascript t'boot. I use them all the time, but had no idea they were called expandos (horrid name), or - more importantly - that they could cause garbage collection problems. I'll read up on this. Thanks, again Chris On 3/1/07, Mike Alsup [EMAIL PROTECTED] wrote: Please correct me if I'm understanding this the wrong way. Strings are safe. Object references are not. That's correct. It's safe to store primitives in an expando because the aren't reference counted for garbage collection. But objects are trouble. An IE memory leak pattern is as simple as this: var o = document.getElementById('A'); document.getElementById('A').myprop = o; Jack Slocum has a good blog entry on avoiding memory leaks: http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/ Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] multiple elements, one function
Apologies if this has been answered elsewhere, but I couldn't find an answer by searching. I suppose this is a newbie question. Is it possible to assign the same function to multiple elements with different id's with one call? For example, with the code below, could I assign the onchange handler to another element with a different id? $(document).ready(function() { // apply onchange handler to 'time' field $(select#time).change(function(){ // send request with amount date as variables $.post(guestCheck.php, {time: $(this).val(), date: $(select#date).val()}, function(xml) { //assign callback XML to JavaScript variable var guests = $(guests,xml).text(); alert (guests); }); }); Thanks for any advice. -- View this message in context: http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9267242 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] multiple elements, one function
Dan, You can separate your selectors with a comma. Also you don't need to specify a context (eg element type) when selecting an id. Eg #time is faster that select#time. So try: $(#time, #anotherId).change(function() {}); Cheers, Chris ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] [FYI] fine Tool used JQuery
on 2007-3-2 16:19,Olaf Bosch said the following: Hi all, have a look: http://www.riddle.pl/emcalc/ tool for fontsize in em to view in px Good A little question: table.font-size=0.8em input.font-size=0.7em then in IE6 tableinput value=test/table test的size=0.8*0.7=0.56? style table{font-size:0.8em;} input{font-size:0.7em;} /style input value=Out table size is 0.7em/input table trtdinput value=In table size is 0.56em?/input/td/tr /table How to solve this question? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] [FYI] fine Tool used JQuery
weide schrieb: you go so: style table{font-size:0.8em;} table input{font-size:1em;} input{font-size:0.7em;} /style input value=Out table size is 0.8em/input table trtdinput value=In table size is 0.8em?/input/td/tr /table How to solve this question? HTH. ACHTUNG, i not written this tool ;) -- Viele Grüße, Olaf --- [EMAIL PROTECTED] http://olaf-bosch.de www.akitafreund.de --- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Google Toolbar and jQuery validation
Hi all, I'm using the validation plugin to - well - validate a form, and I fire a validation event when the element in question is changed to ensure it contains a valid value. When it does, I change it's class to indicate this. If someone uses the Google Toolbar's autofill function to fill this form in, the controls aren't validated and my classes aren't applied - I'm guessing because onChange isn't firing? Is there any other way I can look for this happening and act accordingly? Regards, Michael Price ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ajaxSubmit not defined
I tested it long time ago and it didnt work, cool then. I hate IE, and rather Firefox than Opera, I'm building a MMORPG and I'll put a filter to FF users ;) On 2/25/07, Mike Alsup [EMAIL PROTECTED] wrote: $(function() { // OUTPUT login var login_options = { target: '#output-login' }; $('#login').ajaxForm(login_options); // PUT HERE MORE ajaxForm items... // BUSY state $('div id=busyLoading.../div') .ajaxStart(function() {$(this).show();}) .ajaxStop(function() {$(this).hide();}) .appendTo('body'); }); } --- but it only works on Firefox, Opera and IE are not compatible with it Can you explain that last statement? That code works on Opera and IE. Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] JS Source code Formatter - Anyone know of any good ones
On 02/03/07, harningt [EMAIL PROTECTED] wrote: Tsz Ming WONG wrote: maybe http://astyle.sourceforge.net/ ? you might need to tweak the settings for javascript. This seems the ideal tool to me, however it completely screws up when dealing w/ function creation.. Ex: /* Desired target for where I work (I prefer inline braces, since it wastes less space, but I digress.) */ var x = function() { return function() { return 0; } }; Astyle likes to format in this matter: var x = function() { return function() { return 0; } } Which is horrible.. increases nesting depth insanely. (may not show up right because I'm editing in Nabble's text-area -- I find it also inserts spaces even though I tell it not to: AStyle.exe -beyFTE myfile.js It's a shame there are no free command line utilities (that don't have a bug like that) for code formatting like how Visual Studio can do it (specifying spaces or tabs, brackets on newlines or not, etc). Tidy works with HTML, but you can't tell it to use tabs instead (i.e. the developer(s) is basically forcing his coding style onto the users of the software), it complains about malformed documents, and it outputs more than just the tidied HTML when it is finished. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Bug when overriding links within specific context, using jQuery 1.1.*?
Hi everyone, I have got some trouble getting this snippet of code working in newer versions of jQuery: $(document).ready(function(){ $(p).each(function(){ $(this).load(ajax.php, function(context){ $(a,context).click(function(){ alert(The link is overridden.); return false; }); }); }); }); ajax.asp contains the link, and the site itself contains a p. The code above for overriding a link only works well in jQuery 1.1.2 if I - take away the context-limitation. But that makes it unstable when using it on pages with many links (both in old and new versions of jQuery) - don't load the links with Ajax -- but I need that. Everything is fine in the old one. v1.0.4: http://gawis.dk/jquery-testbed/overridelinks/ v1.1.2: http://gawis.dk/jquery-testbed/overridelinks/?ver=new Any ideas about what's wrong in 1.1.2 and how to overcome it, or do I just have to stay with the old jQuery 1.0.4 ? -- View this message in context: http://www.nabble.com/Bug-when-overriding-links-within-specific-context%2C-using-jQuery-1.1.*--tf905.html#a9270505 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Accordion Menu setting
33. Accordion Menu setting (itmanager).. Answer: Hi Manager dude, Hi ITguy... my 1st chance to shine and help out :) Hey check this layout: http://www.generalmedicine.com/index2.htm SebDuggan.com supplied me the toggle behavior. Thought I would email you direct, (I hope this is the right addie). Check my last post in this forum thread for the code from Seb: http://forum.stylegala.com/about5162.html My code got a bit muddied on the page because I had conflicts with the smooth slideshow gallery that uses mooTools. I never could resolve those conflicts, and had to show the slideshow in an Iframe using another jQuery plugin for iframes from 33Rockers.com. Thanks, I'll post this in the mailing list also. Thanks, Ty PS: Apologies, I've no idea how to reply to the discuss mailing list using the forum here at nabble/software/javascript/jquery... or something :) itmanager-2 wrote: Hi everybody, Ive been testing the accordion menu (http://docs.jquery.com/Tutorials:Accordion_Menu_%28Screencast%29) I try several things on the code but didnt work. The accordion menu, by default, on click slide and show the items, but if I click again on the same item, the menu doesnt hide. I want to know if its possible to make the menu on click-shows and if I click the same item then the menu slides and close again. thanks for your help Sent via the WebMail system at tripven.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Accordion-Menu-setting-tf3331798.html#a9270735 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Tree plugin with AJAX calls?
A friend of mine was asking me if I knew of a tree plugin that loaded in it's branches/leaves with AJAX. I saw Jorn's plugin (which looks awesome), but is there a jQuery plugin that does with AJAX? Andy Matthews Senior Coldfusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED] www.dealerskins.com http://www.dealerskins.com/ dealerskinslogo.bmp Description: Windows bitmap ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Paging small recordset
Hello All, I¹m looking to get started with jQuery (finally been lurking for a while!). I need to be able to page through a small recordset but because of its small size, I don¹t need to go back to the server for the data just to display/hide records for the 3-4 pages of data to display. However, rather than a 1 record per row table display I need a 3 records per row style layout with product name and product image in each table cell. Any thoughts on the kind of control, recommendations or starting points? Best Wishes, Peter ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Paging small recordset
Take a look at the plugin below and see if that helps. http://rikrikrik.com/jquery/pager/ On 3/2/07, Peter Bell [EMAIL PROTECTED] wrote: Hello All, I'm looking to get started with jQuery (finally – been lurking for a while!). I need to be able to page through a small recordset but because of its small size, I don't need to go back to the server for the data – just to display/hide records for the 3-4 pages of data to display. However, rather than a 1 record per row table display I need a 3 records per row style layout with product name and product image in each table cell. Any thoughts on the kind of control, recommendations or starting points? Best Wishes, Peter ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] multiple elements, one function
You might want to avoid using IDs and use a class instead. Like select class=foo or use an attribute like select bindtome=true Then $(select.foo). or $(select[bindtome=true]) will bind to multiple. Additionally, you dont have to bind the actual code there, you could call a seperate function. Lastly, you could use the 'each if the code you want to bind is different depending on circumstances. Each allows you to bind the code one at a time and make adjustments. Check www.jquery.com/api for cut/paste examples. Hope this helps. Glen On 3/2/07, dan j [EMAIL PROTECTED] wrote: Apologies if this has been answered elsewhere, but I couldn't find an answer by searching. I suppose this is a newbie question. Is it possible to assign the same function to multiple elements with different id's with one call? For example, with the code below, could I assign the onchange handler to another element with a different id? $(document).ready(function() { // apply onchange handler to 'time' field $(select#time).change(function(){ // send request with amount date as variables $.post(guestCheck.php, {time: $(this).val(), date: $(select#date).val()}, function(xml) { //assign callback XML to JavaScript variable var guests = $(guests,xml).text(); alert (guests); }); }); Thanks for any advice. -- View this message in context: http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9267242 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Accordion Menu setting
Works perfect thanks a lot I replace the ready function with this one: jQuery(document).ready(function($){ // Do jQuery stuff using $ $(dd).hide(); $('dt a').click(function(){ $(this).parent().next().siblings('dd:visible').slideUp('slow'); $(this).parent().next().slideToggle('slow'); return false; }); }); And the behaviour is once you click on a menu item it opens, if you click again it closes. An all the items on the menu keep hidden Thanks a lot -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de {js}sTyler Enviado el: Viernes, 02 de Marzo de 2007 10:47 a.m. Para: discuss@jquery.com Asunto: Re: [jQuery] Accordion Menu setting 33. Accordion Menu setting (itmanager).. Answer: Hi Manager dude, Hi ITguy... my 1st chance to shine and help out :) Hey check this layout: http://www.generalmedicine.com/index2.htm SebDuggan.com supplied me the toggle behavior. Thought I would email you direct, (I hope this is the right addie). Check my last post in this forum thread for the code from Seb: http://forum.stylegala.com/about5162.html My code got a bit muddied on the page because I had conflicts with the smooth slideshow gallery that uses mooTools. I never could resolve those conflicts, and had to show the slideshow in an Iframe using another jQuery plugin for iframes from 33Rockers.com. Thanks, I'll post this in the mailing list also. Thanks, Ty PS: Apologies, I've no idea how to reply to the discuss mailing list using the forum here at nabble/software/javascript/jquery... or something :) itmanager-2 wrote: Hi everybody, Ive been testing the accordion menu (http://docs.jquery.com/Tutorials:Accordion_Menu_%28Screencast%29) I try several things on the code but didnt work. The accordion menu, by default, on click slide and show the items, but if I click again on the same item, the menu doesnt hide. I want to know if its possible to make the menu on click-shows and if I click the same item then the menu slides and close again. thanks for your help Sent via the WebMail system at tripven.com ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Accordion-Menu-setting-tf3331798.html#a9270735 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] multiple elements, one function
Actually, you may want to avoid using custom attributes (expandos), problems with this were discussed yesterday: - Err no, actually *expandos* refers to non-standard attributes that get added to DOM elements. They expand the attributes that are available on an element. For instance adding an *expando* attribute called hello: input type=submit value=blah hello=Hello world! Because they're non-standard they can cause memory leak problems under Internet Explorer if they refer to other DOM elements. More info here: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/* expando*.asphttp://msdn.microsoft.com/workshop/author/dhtml/reference/properties/expando.asp Karl Rudd --- - jake On 3/2/07, Glen Lipka [EMAIL PROTECTED] wrote: You might want to avoid using IDs and use a class instead. Like select class=foo or use an attribute like select bindtome=true Then $(select.foo). or $(select[bindtome=true]) will bind to multiple. Additionally, you dont have to bind the actual code there, you could call a seperate function. Lastly, you could use the 'each if the code you want to bind is different depending on circumstances. Each allows you to bind the code one at a time and make adjustments. Check www.jquery.com/api for cut/paste examples. Hope this helps. Glen On 3/2/07, dan j [EMAIL PROTECTED] wrote: Apologies if this has been answered elsewhere, but I couldn't find an answer by searching. I suppose this is a newbie question. Is it possible to assign the same function to multiple elements with different id's with one call? For example, with the code below, could I assign the onchange handler to another element with a different id? $(document).ready(function() { // apply onchange handler to 'time' field $(select#time).change(function(){ // send request with amount date as variables $.post(guestCheck.php, {time: $(this).val(), date: $(select#date).val()}, function(xml) { //assign callback XML to JavaScript variable var guests = $(guests,xml).text(); alert (guests); }); }); Thanks for any advice. -- View this message in context: http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9267242 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] multiple elements, one function
Thanks to both of you - all very useful stuff! Glen Lipka wrote: You might want to avoid using IDs and use a class instead. Like select class=foo or use an attribute like select bindtome=true Then $(select.foo). or $(select[bindtome=true]) will bind to multiple. Additionally, you dont have to bind the actual code there, you could call a seperate function. Lastly, you could use the 'each if the code you want to bind is different depending on circumstances. Each allows you to bind the code one at a time and make adjustments. Check www.jquery.com/api for cut/paste examples. Hope this helps. Glen On 3/2/07, dan j [EMAIL PROTECTED] wrote: Apologies if this has been answered elsewhere, but I couldn't find an answer by searching. I suppose this is a newbie question. Is it possible to assign the same function to multiple elements with different id's with one call? For example, with the code below, could I assign the onchange handler to another element with a different id? $(document).ready(function() { // apply onchange handler to 'time' field $(select#time).change(function(){ // send request with amount date as variables $.post(guestCheck.php, {time: $(this).val(), date: $(select#date).val()}, function(xml) { //assign callback XML to JavaScript variable var guests = $(guests,xml).text(); alert (guests); }); }); Thanks for any advice. -- View this message in context: http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9267242 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/multiple-elements%2C-one-function-tf3332805.html#a9272622 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Animate() : background color
hello! i'm trying to have jquery fade between 2 colors, but can't get it to work, here is what i'm trying: $('#contactForm').animate({left: 400, width: 300, height: 600, backgroundColor: #617B8C},slow,linear,showContactInfo); the docs specifies it must be camel cased, which i did . What am i doing wrong? thank you !! alexandre Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 HYPERLINK blocked::http://www.lab-au.com/http://www.lab-au.com HYPERLINK blocked::http://www.mediaruimte.be/http://www.mediaruimte.be HYPERLINK blocked::http://www.mediaruimte.be/__ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.447 / Base de données virus: 268.18.5/707 - Date: 1/03/2007 14:43 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Animate() : background color
Hi Alexandre, The core jQuery .animate() method works only for properties that take numeric values (although you can use the shortcut strings show, hide, and toggle as well). For animation of other CSS properties, or even classes, check out the Interface plugin suite (and ifx.js in particular): http://interface.eyecon.ro http://interface.eyecon.ro/docs/animate Also, you don't need to add the easing parameter if you want it to be the default, linear. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 2, 2007, at 12:23 PM, Alexandre Plennevaux wrote: hello! i'm trying to have jquery fade between 2 colors, but can't get it to work, here is what i'm trying: $('#contactForm').animate({left: 400, width: 300, height: 600, backgroundColor: #617B8C},slow,linear,showContactInfo); the docs specifies it must be camel cased, which i did . What am i doing wrong? thank you !! alexandre Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com http://www.mediaruimte.be __ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.447 / Base de données virus: 268.18.5/707 - Date: 1/03/2007 14:43 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bug when overriding links within specific context, using jQuery 1.1.*?
I think this is due to the fact that no context is passed in to the .load() callback, in that manner. I think doing something like this would work: $(document).ready(function(){ $(p).each(function(){ $(this).load(ajax.php, function(){ $(a,this).click(function(){ alert(The link is overridden.); return false; }); }); }); }); That way, only the links directly within the paragraph will be overridden. --John On 3/2/07, Søren Haagerup [EMAIL PROTECTED] wrote: Hi everyone, I have got some trouble getting this snippet of code working in newer versions of jQuery: $(document).ready(function(){ $(p).each(function(){ $(this).load(ajax.php, function(context){ $(a,context).click(function(){ alert(The link is overridden.); return false; }); }); }); }); ajax.asp contains the link, and the site itself contains a p. The code above for overriding a link only works well in jQuery 1.1.2 if I - take away the context-limitation. But that makes it unstable when using it on pages with many links (both in old and new versions of jQuery) - don't load the links with Ajax -- but I need that. Everything is fine in the old one. v1.0.4: http://gawis.dk/jquery-testbed/overridelinks/ v1.1.2: http://gawis.dk/jquery-testbed/overridelinks/?ver=new Any ideas about what's wrong in 1.1.2 and how to overcome it, or do I just have to stay with the old jQuery 1.0.4 ? -- View this message in context: http://www.nabble.com/Bug-when-overriding-links-within-specific-context%2C-using-jQuery-1.1.*--tf905.html#a9270505 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] $(node).hasClass(...) function
Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Enhancements to Imagebox
Hi Tobbe I don't know, I tried the following setting inthe thickbox.css file but it didn't work: #ImageBoxLoader { background-color: transparent; } I don't know if the problem is with jQuery or Interface. The loading.gif does have a transparent background so it should display as such. The interface demo is on a white background so it is hard to tell if it is using transparency. Janet Weber -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Torbjorn Tornkvist Sent: Friday, March 02, 2007 3:08 AM To: discuss@jquery.com Subject: Re: [jQuery] Enhancements to Imagebox Janet Weber wrote: Hi Tobbe I was wandering if you noticed that the loading.gif graphic dosen't have a transparent background? Hm...yes, when you mention it :-) So how do I make its background transparent? I'm no good at doing graphics like that. Cheers, Tobbe Janet -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Torbjorn Tornkvist Sent: Thursday, March 01, 2007 8:14 PM To: discuss@jquery.com Subject: [jQuery] Enhancements to Imagebox Hi, I've done some enhancements to Imagebox that may be of general interest. Added: + a stop() function that undo what init() does. + a closeHook option that is called when Imagebox is closed. + a nextImage2 and prevImage2 element that are placed to the left of closeHTML I'm not sure what the process is when contributing code but the code can be found here (for a while): http://noneg.tornkvist.org:8080/js/imagebox.js It is based on what I checked out from svn some hours ago. For an example of the new functionality, see: http://noneg.tornkvist.org:8080/search.yaws?adonly=falseaction=keywordke y=barcelona Click on the link named: Bildspel at the top. Cheers, Tobbe ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
You can use: $(node).is('.className') Sébastien Pierre wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
give this a try: $(node).is(.class) --John On 3/2/07, Sébastien Pierre [EMAIL PROTECTED] wrote: Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] :first selector perofmance question
Sam Collett schrieb: It's in the works: http://www.w3.org/TR/selectors-api/ But that will take another few years I think. Until then we're lucky to have jQuery. -- Klaus Knowing how long the W3C takes on recommendations and the lack of willingness of a certain browser developer to keep up to date with them (and participate in creating them), it will be a lot longer than that (if ever). You could probably implement that with javascript now (preferably in a way not to depend on any other libraries), but it would not be as fast as if the browser did it natively. I wonder how hard it is to implement? I mean, the parser is already there for CSS. John, tell us some Mozilla internals ;-) -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Auto completion example
Hi there, Is there an auto-complete example using jquery somewhere. For example, a user types in a few words into a text field and then I get some ajax content. I know already how to get the content using jquery's ajax functions. My question really is how to code the part where the text field loads the contents as the user types. Any ideas welcome. Thanks Ricardo Parada ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] :first selector perofmance question
I wonder how hard it is to implement? I mean, the parser is already there for CSS. John, tell us some Mozilla internals ;-) I know that getElementsByClassName is already in Firefox 3, we'll have to see if something like CSS selectors does, though. The problem is that CSS selectors they don't, necessarily, deal directly with a DOM representation of an HTML document. It may be optimized in a completely different way that allows it to perform better. All of this is good, but extrapolating that engine out and forcing it to work over a DOM document is a different story. I haven't dug deep into the Moz. implementation, but I'm going to assume that the two engines aren't immediately related (which means it'll be harder to implement than you would think). --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] metadata by means of metaobjects
I just got to version 1.3 thanks to the feedback generated by this thread. Daniel Wachsstock sent me his shorter version, which I could easily integrate. I fixed some bugs (he cut too much), but it's ok now. I updated the Metaobjects manual with your words, John :-) I must admit that I didn't get that as clear as you just explained. John Resig wrote: The problem is that it's a fundamentally different way of dealing with Metadata. Metaobjects is much more pro-active, whereas the Metadata plugin is passive in nature. That's not a bad thing, it's just different. For example, with the Metaobjects plugin you can setup rules to have data bound to certain selectors, whereas in the Metadata plugin you can only attach JSON-formatted data to individual elements. And just to reply to one point on the Metaobjects site: The 'element content' method is easily used with a SCRIPT element, because its content stays automatically hidden, but it can clash with your regular scripts. That is incorrect. You're supposed to use a script tag with a type of application/json - the official mimetype for JSON data. Browsers ignore script tags that completely, it is not executed in any way. It is true that the element is not cleaned up after itself, but that should be remedied - and it's an easy fix. The object/param style syntax could be included straight into the Metadata plugin, but I wouldn't want to undermine how the Metaobjects plugin works (while, at the same time, not providing the exact capabilities of the Metaobject plugin). With that being said - it's up to Andrea, while Metaobjects certainly won't replace the Metadata plugin, they could certainly be merged - it would simply require a little more work, but it may be worth it. It should also be noted that the Metaobjects plugin is, fundamentally, faster than the Metadata plugin as it can quickly search through a DOM structure for a specific pattern, rather than trying to load the information on the fly. (Granted this technique could be introduced into the Metadata plugin for the 'elem' style of Metadata, but I'd hate to duplicate efforts in this matter.) --John On 3/1/07, Erik Beeson [EMAIL PROTECTED] wrote: I'm curious to hear other people's thoughts on this approach. If it's a sound idea, why isn't it part of the official metadata plugin? --Erik On 3/1/07, Andrea Ercolino [EMAIL PROTECTED] wrote: I was wondering if anyone is using my http://www.mondotondo.com/aercolino/noteslog/?page_id=105 Metaobjects plugin as a replacement for the metadata plugin. It's now at version 1.2 and I'm really proud of this simple tool. The best features of Metaobjects are: -- valid XHTML mark-up -- auto clean up by default -- attach data to properties of dom elements directly -- add any writable property or a brand new one -- each value is evaluated and then the result is assigned -- data can be any javascript expression: function declarations and calls too -- each metaobject can be further customized by a metaparam -- target is metaobject's parent by default, but can be changed to any jquery selector (sort of one metaobject to rule them all ;-) -- default behavior is customizable -- user decides what metaobjects are processed and when to do it -- View this message in context: http://www.nabble.com/metadata-by-means-of-metaobjects-tf3327825.html#a9252509 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/metadata-by-means-of-metaobjects-tf3327825.html#a9275732 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Auto completion example
There's one or more autocomplete plugins listed on the plugins page of jQuery.com: http://docs.jquery.com/Plugins -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ricardo Parada Sent: Friday, March 02, 2007 1:08 PM To: discuss@jquery.com Subject: [jQuery] Auto completion example Hi there, Is there an auto-complete example using jquery somewhere. For example, a user types in a few words into a text field and then I get some ajax content. I know already how to get the content using jquery's ajax functions. My question really is how to code the part where the text field loads the contents as the user types. Any ideas welcome. Thanks Ricardo Parada ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] slideUp not collapsing tbody?
I'm trying to build a form that needs to show or hide a portion depending on the user's previous input. I'm trying to use slideUp/slideDown to make the transition but it's not working - are there any gotchas in trying to interact with tbody vs div? Is it not possible to use these effects with tbody? -- View this message in context: http://www.nabble.com/slideUp-not-collapsing-tbody--tf3335465.html#a9275952 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Yes, I'm think this function very usefull, but jquery only has an internal function $.className.has(). Best wishes, Toby 2007-3-3 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sébastien Pierre Sent: 2007年3月3日 2:06 To: jQuery Discussion. Subject: [jQuery] $(node).hasClass(...) function Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] metadata by means of metaobjects
It should also be noted that the Metaobjects plugin is, fundamentally, faster than the Metadata plugin as it can quickly search through a DOM structure for a specific pattern, rather than trying to load the information on the fly. I'm unclear about the performance difference between the two plugins. How is the performance of the metaobjects plugin any different than the metadata plugin using nested script tags? I guess I should just test it and see :) --Erik ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] JQuery Xpath working?
Hi, I'm having trouble getting xpath selectors to work well, particularly on XML responses from ajax requests, using FF. Hoping somebody can help. Here are the steps I'm taking: 1. Perform an ajax request using Prototype's Ajax.request, with an onComplete callback to my function. Here's a sample response: ?xml version=1.0? XMLResponse Errors/ Warnings/ Messages/ Response ProductType Id40/Id NameChain/Name ProductGroupBMX/ProductGroup Margin/ Properties PropertyTemplate Sid44c0ade1561d3/Sid ProductTypeId40/ProductTypeId PropertyTypeId34/PropertyTypeId PropertyType/ Required0/Required NameWeight/Name Type1/Type /PropertyTemplate /Properties /ProductType /Response /XMLResponse 2. In my function, calling jQuery(//ProductType/Properties/ PropertyTemplate) on the responseXML property of the response. I get zero elements. 3. Replacing the jquery with a css-style selector, works: jQuery (ProductType Properties PropertyTemplate) returns 1 element. I'd prefer to use xpath over css. Any thoughts? Thanks! -jeff ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $(node).hasClass(...) function
Sorry when I reading John Resig's reply... -Original Message- From: Microtoby [mailto:[EMAIL PROTECTED] Sent: 2007年3月3日 3:44 To: 'jQuery Discussion.' Subject: RE: [jQuery] $(node).hasClass(...) function Yes, I'm think this function very usefull, but jquery only has an internal function $.className.has(). Best wishes, Toby 2007-3-3 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sébastien Pierre Sent: 2007年3月3日 2:06 To: jQuery Discussion. Subject: [jQuery] $(node).hasClass(...) function Hi all, I was wondering if somebody would be interested in a hasClass(...) function for jQuery. I would definitely find it useful, and am willing to contribute it. -- Sébastien ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] slideUp not collapsing tbody?
there are problems animating table rows that haven't been solved yet, from what I understand. Table rows need to be display: table-row and the animations need to be display: block, hence there's an inherent mismatch. You can toggle tbody's though - this is an example I worked out: http://www.monkeypuzzle.net/testfiles/jquery/Accordion_table/index_2.html hope that helps Daemach wrote: I'm trying to build a form that needs to show or hide a portion depending on the user's previous input. I'm trying to use slideUp/slideDown to make the transition but it's not working - are there any gotchas in trying to interact with tbody vs div? Is it not possible to use these effects with tbody? -- View this message in context: http://www.nabble.com/slideUp-not-collapsing-tbody--tf3335465.html#a9276518 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Interface Animation and element positioning
I've been trying to use Interface to animate various elements, specifically using the slide functions. What I would like to do is have a div slide out of the center of the top screen, but the styling I have in place to center the div isn't active during the animation, only after the animation is complete. So, my question is, how do I do get my div centered and continue to stay centered while interface is firing a slide? - jake ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] metadata by means of metaobjects
The speed difference between the script tag technique and the object/param technique is negligible (or, will be, once I fix the script tag technique in the Metadata plugin to be more pro-active). The primary difference between those two techniques and the classname and data attribute techniques is that you can do a single search through the DOM, looking for the script/object elements, applying the data directly. Whereas with the two attribute techniques, you have to check every single element that you come across, to verify if it does, in fact, have that particular attribute, finally loading the data. It's the difference between a one-time cost, or a constantly-reoccurring cost. --John On 3/2/07, Erik Beeson [EMAIL PROTECTED] wrote: It should also be noted that the Metaobjects plugin is, fundamentally, faster than the Metadata plugin as it can quickly search through a DOM structure for a specific pattern, rather than trying to load the information on the fly. I'm unclear about the performance difference between the two plugins. How is the performance of the metaobjects plugin any different than the metadata plugin using nested script tags? I guess I should just test it and see :) --Erik ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] ANNOUNCE: Thickbox Reloaded alpha
Just tried this in IE7 (WinXPSP2) and the overlay is solid black. Some of the CSS positioning is also a little out of kilter, but everything works! Looking forward to this one Klaus :) Luke Klaus Hartl wrote: Sean O schrieb: Klaus, Nice job, everything looks great in Firefox 2 IE 7 PC. Sean, as I said, I haven't done any testing in IE at all so far. I'm truly amazed, that it looks great in IE 7 already. :-) -- Klaus -- View this message in context: http://www.nabble.com/ANNOUNCE%3A-Thickbox-Reloaded-alpha-tf3293077.html#a9277570 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Bind event to radio button group
I'm new to jQuery. I'm trying to bind a function to a group of radio buttons. For example, $([EMAIL PROTECTED]).bind(click, function() { alert ('radio button clicked'); } ); should run the function anytime a radio button named 'rb' is clicked but isn't working. Am I approaching this the wrong way, or is my jQuery syntax wrong? Thanks, Brad ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Try: $(input:[EMAIL PROTECTED]).click(function() { alert('radio button clicked'); }); I ran into the same problem - you have to include the radio selector or it won't work. Also you don't need to use bind, you can directly bind the click function using the syntax above. -- Josh - Original Message - From: Brad Perkins [EMAIL PROTECTED] To: discuss@jquery.com Sent: Friday, March 02, 2007 1:30 PM Subject: [jQuery] Bind event to radio button group I'm new to jQuery. I'm trying to bind a function to a group of radio buttons. For example, $([EMAIL PROTECTED]).bind(click, function() { alert ('radio button clicked'); } ); should run the function anytime a radio button named 'rb' is clicked but isn't working. Am I approaching this the wrong way, or is my jQuery syntax wrong? Thanks, Brad ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Brad, Looks like you need to use the .each function to iterate through each radio button. Here's some demo code: http://www.bennadel.com/blog/534-The-Beauty-Of-The-jQuery-Each-Method.htm Docs: http://jquery.bassistance.de/api-browser/#eachFunction SEAN O http://www.sean-o.com/ Brad Perkins-2 wrote: I'm new to jQuery. I'm trying to bind a function to a group of radio buttons. For example, $([EMAIL PROTECTED]).bind(click, function() { alert ('radio button clicked'); } ); should run the function anytime a radio button named 'rb' is clicked but isn't working. Am I approaching this the wrong way, or is my jQuery syntax wrong? Thanks, Brad ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Bind-event-to-radio-button-group-tf3336101.html#a9278174 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Code for your example (just tested): $([EMAIL PROTECTED]).each( // For each button, run this code. The i is the loop iteration index on the current element function( i ){ // Bind the onclick event to alert the iteration index value $( this ).bind( click, function(){ alert( You Clicked Index #: + i ); } ); } ); The code that Josh just posted works too, if you don't need an index. BTW, welcome to jQuery. SEAN O http://www.sean-o.com Sean O wrote: Brad, Looks like you need to use the .each function to iterate through each radio button. Here's some demo code: http://www.bennadel.com/blog/534-The-Beauty-Of-The-jQuery-Each-Method.htm Docs: http://jquery.bassistance.de/api-browser/#eachFunction SEAN O http://www.sean-o.com/ Brad Perkins-2 wrote: I'm new to jQuery. I'm trying to bind a function to a group of radio buttons. For example, $([EMAIL PROTECTED]).bind(click, function() { alert ('radio button clicked'); } ); should run the function anytime a radio button named 'rb' is clicked but isn't working. Am I approaching this the wrong way, or is my jQuery syntax wrong? Thanks, Brad ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Bind-event-to-radio-button-group-tf3336101.html#a9278351 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Josh and Sean, Thanks for the help. Both solutions appear to work. Part of my problem was that I was initially performing the bind in $(document).ready(...). At first neither of your suggestions worked. Then I realized that the radio buttons I want to bind to are in a table that appear in the page later via an AJAX call. If I return your examples with the AJAX content the bind works. Is there a better way to do that? Thanks! -- Brad ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] how to find an item when you only know part of the class name
Hi, I have a DIV whose ID I know. Within that DIV is a table with a table cell which either has a class beginning with the word title and followed by an integer. I would like to reference the text within that table cell. What is the easiest way to get a reference to this cell? Thanks, - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] how to find an item when you only know part of the class name
You can reference any attribute using the following notation: [EMAIL PROTECTED] Starts with [EMAIL PROTECTED] Ends with [EMAIL PROTECTED] equals [EMAIL PROTECTED] contains So for your problem... $([EMAIL PROTECTED]) Hope this helps, - jake On 3/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a DIV whose ID I know. Within that DIV is a table with a table cell which either has a class beginning with the word title and followed by an integer. I would like to reference the text within that table cell. What is the easiest way to get a reference to this cell? Thanks, - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
If I return your examples with the AJAX content the bind works. Is there a better way to do that? AFAIK that's the only way to do it, if your radio buttons only appear after an AJAX call. But, I am a noob myself, so don't take my word for it! -- Josh ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] how to find an item when you only know part of the class name
---Original Message--- From: Jake McGraw [EMAIL PROTECTED] Subject: Re: [jQuery] how to find an item when you only know part of the class name Sent: Mar 02 '07 22:46 You can reference any attribute using the following notation: [EMAIL PROTECTED] Starts with [EMAIL PROTECTED] Ends with [EMAIL PROTECTED] equals [EMAIL PROTECTED] contains So for your problem... $([EMAIL PROTECTED]) Hope this helps, - jake On 3/2/07, [LINK: MAILTO:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a DIV whose ID I know. Within that DIV is a table with a table cell which either has a class beginning with the word title and followed by an integer. I would like to reference the text within that table cell. What is the easiest way to get a reference to this cell? Thanks, - Dave ___ jQuery mailing list [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/ I appreciate your reply. I'm still not finding the element, and I wanted to ask what I was doing wrong. The JS is $(document).ready( function () { $('a.toggleStrike').click( function() { var parentDiv = $(this).parents([EMAIL PROTECTED]); alert(parentDiv[0].id); var tdElt = parentDiv.find([EMAIL PROTECTED]); alert(tdElt[0].id); var textDecor = tdElt.css('text-decoration'); var newDecor = textDecor == line-through ? none : line-through; tdElt.css('text-decoration', newDecor); }); } ) and a sample HTML div would be div id=toc25 class=tocItem15-2 style=display:block; margin-left:30px div style=display:blocktable tr td/td td style=text-decoration:none class=title3Lesson 1 Core Ancient Americans/td tda class=readMore href='#'Read/a/td tda href='#' class=toggleStrikeRemove/td /tr /table/div /div The first alert displays the correct value, but the second alert displays a blank box and subsequently everything in the highest level table gets a strike through it when I just want this one cell. Thanks, - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Paging small recordset
Looks great many thanks. Best Wishes, Peter On 3/2/07 11:00 AM, Benjamin Sterling [EMAIL PROTECTED] wrote: Take a look at the plugin below and see if that helps. http://rikrikrik.com/jquery/pager/ On 3/2/07, Peter Bell [EMAIL PROTECTED] wrote: Hello All, I'm looking to get started with jQuery (finally been lurking for a while!). I need to be able to page through a small recordset but because of its small size, I don't need to go back to the server for the data just to display/hide records for the 3-4 pages of data to display. However, rather than a 1 record per row table display I need a 3 records per row style layout with product name and product image in each table cell. Any thoughts on the kind of control, recommendations or starting points? Best Wishes, Peter ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] how to find an item when you only know part of the class name
---Original Message--- From: Jake McGraw [EMAIL PROTECTED] Subject: Re: [jQuery] how to find an item when you only know part of the class name Sent: Mar 02 '07 23:19 Not sure if the source is like this too, but you haven't closed this element (insert a /a): a href='#' class=toggleStrikeRemove/a /td Maybe, that'll help? - jake On 3/2/07, [LINK: MAILTO:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ---Original Message--- From: Jake McGraw [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Subject: Re: [jQuery] how to find an item when you only know part of the class name Sent: Mar 02 '07 22:46 You can reference any attribute using the following notation: [EMAIL PROTECTED] Starts with [EMAIL PROTECTED] Ends with [EMAIL PROTECTED] equals [EMAIL PROTECTED] contains So for your problem... $([EMAIL PROTECTED]) Hope this helps, - jake On 3/2/07, [LINK: MAILTO: [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I have a DIV whose ID I know. Within that DIV is a table with a table cell which either has a class beginning with the word title and followed by an integer. I would like to reference the text within that table cell. What is the easiest way to get a reference to this cell? Thanks, - Dave ___ jQuery mailing list [LINK: mailto:[LINK: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com [LINK: [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/] [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/ I appreciate your reply. I'm still not finding the element, and I wanted to ask what I was doing wrong. The JS is $(document).ready( function () { $('a.toggleStrike').click( function() { var parentDiv = $(this).parents([EMAIL PROTECTED]); alert(parentDiv[0].id); var tdElt = parentDiv.find([EMAIL PROTECTED]); alert(tdElt[0].id); var textDecor = tdElt.css('text-decoration'); var newDecor = textDecor == line-through none : line-through; tdElt.css('text-decoration', newDecor); }); } ) and a sample HTML div would be div id=toc25 class=tocItem15-2 style=display:block; margin-left:30px div style=display:blocktable tr td/td td style=text-decoration:none class=title3Lesson 1 Core Ancient Americans/td tda class=readMore href='#'Read/a/td tda href='#' class=toggleStrikeRemove/td /tr /table/div /div The first alert displays the correct value, but the second alert displays a blank box and subsequently everything in the highest level table gets a strike through it when I just want this one cell. Thanks, - Dave ___ jQuery mailing list [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/ That was indeed a problem. Sadly, even after I remedied that, I still get the same result -- the second alert shows a blank value and the entire table gets a line through it. - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] how to find an item when you only know part of the class name
Not sure if the source is like this too, but you haven't closed this element (insert a /a): a href='#' class=toggleStrikeRemove/a/td Maybe, that'll help? - jake On 3/2/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ---Original Message--- From: Jake McGraw [EMAIL PROTECTED] Subject: Re: [jQuery] how to find an item when you only know part of the class name Sent: Mar 02 '07 22:46 You can reference any attribute using the following notation: [EMAIL PROTECTED] Starts with [EMAIL PROTECTED] Ends with [EMAIL PROTECTED] equals [EMAIL PROTECTED] contains So for your problem... $([EMAIL PROTECTED]) Hope this helps, - jake On 3/2/07, [LINK: MAILTO:[EMAIL PROTECTED] [EMAIL PROTECTED] [LINK: mailto:[EMAIL PROTECTED] ] [EMAIL PROTECTED] wrote: Hi, I have a DIV whose ID I know. Within that DIV is a table with a table cell which either has a class beginning with the word title and followed by an integer. I would like to reference the text within that table cell. What is the easiest way to get a reference to this cell? Thanks, - Dave ___ jQuery mailing list [LINK: mailto:[EMAIL PROTECTED] discuss@jquery.com [LINK: http://jquery.com/discuss/] http://jquery.com/discuss/ I appreciate your reply. I'm still not finding the element, and I wanted to ask what I was doing wrong. The JS is $(document).ready( function () { $('a.toggleStrike').click( function() { var parentDiv = $(this).parents([EMAIL PROTECTED]); alert(parentDiv[0].id); var tdElt = parentDiv.find ([EMAIL PROTECTED]); alert(tdElt[0].id); var textDecor = tdElt.css ('text-decoration'); var newDecor = textDecor == line-through ? none : line-through; tdElt.css('text-decoration', newDecor); }); } ) and a sample HTML div would be div id=toc25 class=tocItem15-2 style=display:block; margin-left:30px div style=display:blocktable tr td/td td style=text-decoration:none class=title3Lesson 1 Core Ancient Americans/td tda class=readMore href='#'Read/a/td tda href='#' class=toggleStrikeRemove/td /tr /table/div /div The first alert displays the correct value, but the second alert displays a blank box and subsequently everything in the highest level table gets a strike through it when I just want this one cell. Thanks, - Dave ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] get element inside a div simple question
I want to get all the Heading element up to 5 (ex h2,h3,h4,h5 ) inside a div like #main_content something like this, but inside the #main_content var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5'); How i can do that with jquery? thanks Sebastián __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] get element inside a div simple question
var main_content = $(#main_content); var toBeTOCced = $(h2,h3,h4,h5, main_content); // there it is -blair sebastianw wurtz wrote: I want to get all the Heading element up to 5 (ex |h2,h3,h4,h5| ) inside a div like #main_content something like this, but inside the #main_content |var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5');| How i can do that with jquery? thanks Sebastián ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Josh, After further testing this doesn't appear to work with IE6 (or Safari). Your technique for binding the radio buttons works in the main page, but it appears that any javascript returned via the ajax call is ignored by IE6 (and also by Safari). BTW, my AJAX stuff is really AJAH (returning HTML). I'm not setting a response type server side. Could that be the problem? -- Brad ps - I notice that all other posts from this list have [jQuery] in the subject. I figured the mailing list automatically included that, but this thread doesn't have it. On 3/2/07, Josh Nathanson [EMAIL PROTECTED] wrote: If I return your examples with the AJAX content the bind works. Is there a better way to do that? AFAIK that's the only way to do it, if your radio buttons only appear after an AJAX call. But, I am a noob myself, so don't take my word for it! -- Josh ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] get element inside a div simple question
If I recall correctly, to get it in order you need to take all elements and then filter manually or do it hierarchically. One way: $('*',main_content).each(function() { if (this.tagName.toLowerCase() == 'h1') // ... else if (this.tagName.toLowerCase() == 'h2') // ... // etc. }); The Other: $('h1',main_content).each(function() { $('h2',this).each(function() { // and so on.. }); }); Which one you use would depend on what your ultimate goal is, though I'm sure either technique can be modified to suit any situation. -blair sebastianw wurtz wrote: But still isnt what i need i making a auto gen table of content list i have this var main_content = $(#main_content); var toBeTOCced = $(h2,h3,h4,h5, main_content); toBeTOCced.each(function(i) { . . }); * 1. Title 1 * 3. Title 2 * 4. Title 3 * 5. Title 4 * 6. Title 5 * 7. Title 2.1 * 8. Title 2.2 * 9. Title 4.1 * 10. Title 4.1 Seems to be not in order. Like is usual i need to put the 2 2.1 2.2 ... - Mensaje original De: Blair Mitchelmore [EMAIL PROTECTED] Para: jQuery Discussion. discuss@jquery.com Enviado: viernes 2 de marzo de 2007, 20:44:55 Asunto: Re: [jQuery] get element inside a div simple question var main_content = $(#main_content); var toBeTOCced = $(h2,h3,h4,h5, main_content); // there it is -blair sebastianw wurtz wrote: I want to get all the Heading element up to 5 (ex |h2,h3,h4,h5| ) inside a div like #main_content something like this, but inside the #main_content |var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5');| How i can do that with jquery? thanks Sebastián ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Accordion Menu setting
Hi, Carlos... I'm working on replicating your accordion menu on the left side of www.generalmedicine.com/index2.htm and was wondering what your css looks like for removing the link border from around your graphics. Could I have a look at that? Is it this referenced file: sideNavs.css ? Thanks, Rick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Sanz Sent: Friday, March 02, 2007 11:26 AM To: 'jQuery Discussion.' Subject: Re: [jQuery] Accordion Menu setting Works perfect thanks a lot I replace the ready function with this one: jQuery(document).ready(function($){ // Do jQuery stuff using $ $(dd).hide(); $('dt a').click(function(){ $(this).parent().next().siblings('dd:visible').slideUp('slow'); $(this).parent().next().slideToggle('slow'); return false; }); }); And the behaviour is once you click on a menu item it opens, if you click again it closes. An all the items on the menu keep hidden Thanks a lot ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Hi Brad, This was hotly debated on another list I'm on - whether it's possible to execute javascript that's been inserted by an AJAX (or AJAH) call. Since you're doing it after the $(document).ready has been fired, it doesn't know to bind the click method. Like I said I'm a noob too so don't take my word for anything! Maybe this is where the .load method comes in, or you have to somehow fire $(document).ready a second time. There are some serious javascript gunslingers on this list who will undoubtedly have an answer, but I think they're mostly in Europe and so are probably soundly asleep. ;0) -- Josh - Original Message - From: Brad Perkins [EMAIL PROTECTED] To: jQuery Discussion. discuss@jquery.com Sent: Friday, March 02, 2007 4:02 PM Subject: Re: [jQuery] Bind event to radio button group Josh, After further testing this doesn't appear to work with IE6 (or Safari). Your technique for binding the radio buttons works in the main page, but it appears that any javascript returned via the ajax call is ignored by IE6 (and also by Safari). BTW, my AJAX stuff is really AJAH (returning HTML). I'm not setting a response type server side. Could that be the problem? -- Brad ps - I notice that all other posts from this list have [jQuery] in the subject. I figured the mailing list automatically included that, but this thread doesn't have it. On 3/2/07, Josh Nathanson [EMAIL PROTECTED] wrote: If I return your examples with the AJAX content the bind works. Is there a better way to do that? AFAIK that's the only way to do it, if your radio buttons only appear after an AJAX call. But, I am a noob myself, so don't take my word for it! -- Josh ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Can multiple functions be attached to the same event?
Or does using .click() twice on the same element overwrite the first binding? -- View this message in context: http://www.nabble.com/Can-multiple-functions-be-attached-to-the-same-event--tf3336878.html#a9280393 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
You can do this with the taconite plugin, which allows you to pass HTML back from the server and insert it into another element on the page. After you've done all your updates, if you include an eval block at the end you can put your script there rebind everything. http://www.malsup.com/jquery/taconite/ Brad Perkins wrote: Josh, After further testing this doesn't appear to work with IE6 (or Safari). Your technique for binding the radio buttons works in the main page, but it appears that any javascript returned via the ajax call is ignored by IE6 (and also by Safari). BTW, my AJAX stuff is really AJAH (returning HTML). I'm not setting a response type server side. Could that be the problem? -- Brad ps - I notice that all other posts from this list have [jQuery] in the subject. I figured the mailing list automatically included that, but this thread doesn't have it. On 3/2/07, Josh Nathanson [EMAIL PROTECTED] wrote: If I return your examples with the AJAX content the bind works. Is there a better way to do that? AFAIK that's the only way to do it, if your radio buttons only appear after an AJAX call. But, I am a noob myself, so don't take my word for it! -- Josh ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/Bind-event-to-radio-button-group-tf3336101.html#a9280429 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Add remove elements in forms - WAS: Re: [FYI] fine Tool used JQuery
Wow! Great idea for add and remove elements! A question for everyone: do you know any example about how to use this idea for add or remove elements for input in forms? Looks like: Enter contacts: (an input field text for contact's name) - Add If user clicks in Add link another inpout field appears. Cheers 2007/3/2, Olaf Bosch [EMAIL PROTECTED]: weide schrieb: you go so: style table{font-size:0.8em;} table input{font-size:1em;} input{font-size:0.7em;} /style input value=Out table size is 0.8em/input table trtdinput value=In table size is 0.8em?/input/td/tr /table How to solve this question? HTH. ACHTUNG, i not written this tool ;) -- Viele Grüße, Olaf --- [EMAIL PROTECTED] http://olaf-bosch.de www.akitafreund.de --- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] get element inside a div simple question
Ok, this is how my final (?) code look I think it have too many if, a function for make the same thing could help but at least it work and perfectly $(#toc).addClass(toc derecha); $(#toc).prepend('h2 id=toctitleTabla de contenidos\/h2ul id=genTOC\/ul'); counter = 1; $('*','#main_content').each(function() { if ( $(this).attr('id') !='toctitle' ) { if ( $(this).is(H2) ) { $(this).before('a name=ref' + counter + ' id=ref' + counter + '/a'); $(#toc ul).append('li class=toclevel-1a href=#ref' + counter + 'span class=tocnumber' + (counter++) + '. /spanspan class=toctext' + $(this).html() + '/span\/a\/li'); } else if ( $(this).is(H3) ) { $(this).before('a name=ref' + counter + ' id=ref' + counter + '/a'); $(#toc ul).append('li class=toclevel-2a href=#' + $(this).html() + 'span class=tocnumber' + (counter++) + '. /spanspan class=toctext' + $(this).html() + '/span\/a\/li'); } else if ( $(this).is(H4) ) { $(this).before('a name=ref' + counter + ' id=ref' + counter + '/a'); $(#toc ul).append('li class=toclevel-3a href=#' + $(this).html() + 'span class=tocnumber' + (counter++) + '. /spanspan class=toctext' + $(this).html() + '/span\/a\/li'); } else if ( $(this).is(H5) ) { $(this).before('a name=ref' + counter + ' id=ref' + counter + '/a'); $(#toc ul).append('li class=toclevel-4a href=#' + $(this).html() + 'span class=tocnumber' + (counter++) + '. /spanspan class=toctext' + $(this).html() + '/span\/a\/li'); } } }); U need to use a css and put in your html div id=toc/div where u want the toc appear if any1 wanna contrib with my first jquery advanced programation can help lol thx sebastian - Original Message - From: Blair Mitchelmore [EMAIL PROTECTED] To: jQuery Discussion. discuss@jquery.com Sent: Friday, March 02, 2007 9:03 PM Subject: Re: [jQuery] get element inside a div simple question If I recall correctly, to get it in order you need to take all elements and then filter manually or do it hierarchically. One way: $('*',main_content).each(function() { if (this.tagName.toLowerCase() == 'h1') // ... else if (this.tagName.toLowerCase() == 'h2') // ... // etc. }); The Other: $('h1',main_content).each(function() { $('h2',this).each(function() { // and so on.. }); }); Which one you use would depend on what your ultimate goal is, though I'm sure either technique can be modified to suit any situation. -blair sebastianw wurtz wrote: But still isnt what i need i making a auto gen table of content list i have this var main_content = $(#main_content); var toBeTOCced = $(h2,h3,h4,h5, main_content); toBeTOCced.each(function(i) { . . }); * 1. Title 1 * 3. Title 2 * 4. Title 3 * 5. Title 4 * 6. Title 5 * 7. Title 2.1 * 8. Title 2.2 * 9. Title 4.1 * 10. Title 4.1 Seems to be not in order. Like is usual i need to put the 2 2.1 2.2 ... - Mensaje original De: Blair Mitchelmore [EMAIL PROTECTED] Para: jQuery Discussion. discuss@jquery.com Enviado: viernes 2 de marzo de 2007, 20:44:55 Asunto: Re: [jQuery] get element inside a div simple question var main_content = $(#main_content); var toBeTOCced = $(h2,h3,h4,h5, main_content); // there it is -blair sebastianw wurtz wrote: I want to get all the Heading element up to 5 (ex |h2,h3,h4,h5| ) inside a div like #main_content something like this, but inside the #main_content |var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5');| How i can do that with jquery? thanks Sebastián ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ __ NOD32 2090 (20070302) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Estoy utilizando la versión gratuita de SPAMfighter para usuarios privados. Ha eliminado 5021 correos spam hasta la fecha. Los abonados no tienen este mensaje en sus correos. ¡Pruebe SPAMfighter gratis ya! ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bind event to radio button group
Thanks for the tip. That looks promising. Brad On 3/2/07, Daemach [EMAIL PROTECTED] wrote: You can do this with the taconite plugin, which allows you to pass HTML back from the server and insert it into another element on the page. After you've done all your updates, if you include an eval block at the end you can put your script there rebind everything. http://www.malsup.com/jquery/taconite/ Brad Perkins wrote: Josh, After further testing this doesn't appear to work with IE6 (or Safari). Your technique for binding the radio buttons works in the main page, but it appears that any javascript returned via the ajax call is ignored by IE6 (and also by Safari). BTW, my AJAX stuff is really AJAH (returning HTML). I'm not setting a response type server side. Could that be the problem? -- Brad ps - I notice that all other posts from this list have [jQuery] in the subject. I figured the mailing list automatically included that, but this thread doesn't have it. On 3/2/07, Josh Nathanson [EMAIL PROTECTED] wrote: If I return your examples with the AJAX content the bind works. Is there a better way to do that? AFAIK that's the only way to do it, if your radio buttons only appear after an AJAX call. But, I am a noob myself, so don't take my word for it! -- Josh ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Why are my graphics jumping?
Hi, all. I've been working on imitating Carlos Sanz' menu at http://www.generalmedicine.com/index2.htm. I've been successful except for one thing: When one of the images in my version of the menu at http://www.whitestonemedia.com/accordion_menu/accordion_menu.html is clicked so that it closes, the graphic jumps a little at the start of it slide upward. I can't for the life of me figure out why. Can someone have a look at the source and tell me if you see anything that might account for that behavior? Rick ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why are my graphics jumping?
Upgrade your jQuery to 1.1.2. The problem was resolved. On 3/2/07, Rick Faircloth [EMAIL PROTECTED] wrote: Hi, all… I've been working on imitating Carlos Sanz' menu at *http://www.generalmedicine.com/index2.htm*http://www.generalmedicine.com/index2.htm . I've been successful except for one thing: When one of the images in my version of the menu at *http://www.whitestonemedia.com/accordion_menu/accordion_menu.html*http://www.whitestonemedia.com/accordion_menu/accordion_menu.html is clicked so that it closes, the graphic jumps a little at the start of it slide upward. I can't for the life of me figure out why. Can someone have a look at the source and tell me if you see anything that might account for that behavior? Rick ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Of extendos, metadata and valid XHMTL - Is it ok to add attributes to elements?
This is more philosophical than anything, but I was just looking over the metadata, metaobjects and validation plugin and I keep coming back to a question of what is the least of all the evils. -- If I add metadata to a class attribute, I risk messing with CSS - classes are for styles. -- If I put metadata in a script tag, it adds weight to the page and the markup is not as clean. -- If I use metaobjects, the resulting document is XHTML compliant but there is a lot of extra coding involved and it increases the size of the initial download, especially if used for validating long complex forms. The best solution to me would be to add an attibute to the elements I want validated called (wait for it...) validate. The document isn't XHTML compliant but the validate element doesn't conflict with anything in the DOM and all browsers are going to ignore this markup because they have to have to handle bad code elegantly. Look at myspace for your example ;) So weigh in. Given the drawbacks of each method, which feels like the right one? -- View this message in context: http://www.nabble.com/Of-extendos%2C-metadata-and-valid-XHMTL---Is-it-ok-to-add-attributes-to-elements--tf3337204.html#a9281386 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why are my graphics jumping?
Hi, Matt. Before I started this little project, I downloaded the latest version from the jquery.com website. I went back just a moment ago, and did the same thing. I'm assuming that the download on the homepage is the latest, 1.1.2? Rick From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Stith Sent: Friday, March 02, 2007 9:55 PM To: jQuery Discussion. Subject: Re: [jQuery] Why are my graphics jumping? Upgrade your jQuery to 1.1.2. The problem was resolved. On 3/2/07, Rick Faircloth [EMAIL PROTECTED] wrote: Hi, all. I've been working on imitating Carlos Sanz' menu at http://www.generalmedicine.com/index2.htm http://www.generalmedicine.com/index2.htm. I've been successful except for one thing: When one of the images in my version of the menu at http://www.whitestonemedia.com/accordion_menu/accordion_menu.html http://www.whitestonemedia.com/accordion_menu/accordion_menu.html is clicked so that it closes, the graphic jumps a little at the start of it slide upward. I can't for the life of me figure out why. Can someone have a look at the source and tell me if you see anything that might account for that behavior? Rick ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Why are my graphics jumping?
To make sure that I had 1.1.2, I went to a previous message on the list that had a link to 1.1.2. http://jquery.com/src/jquery-1.1.2.js .and downloaded jquery again. I noticed in the Carlos source that he's using 1.1.1. I tried his version and that caused the graphics to jump on the slide down as well as the slide up. 1.1.2 gets rid of the jump on the slide down, but not the slide up. ??? Rick From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Stith Sent: Friday, March 02, 2007 9:55 PM To: jQuery Discussion. Subject: Re: [jQuery] Why are my graphics jumping? Upgrade your jQuery to 1.1.2. The problem was resolved. On 3/2/07, Rick Faircloth [EMAIL PROTECTED] wrote: Hi, all. I've been working on imitating Carlos Sanz' menu at http://www.generalmedicine.com/index2.htm http://www.generalmedicine.com/index2.htm. I've been successful except for one thing: When one of the images in my version of the menu at http://www.whitestonemedia.com/accordion_menu/accordion_menu.html http://www.whitestonemedia.com/accordion_menu/accordion_menu.html is clicked so that it closes, the graphic jumps a little at the start of it slide upward. I can't for the life of me figure out why. Can someone have a look at the source and tell me if you see anything that might account for that behavior? Rick ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/