[jQuery] sifr on newly added tags
Hi, I use sifr on some h1 elements in a certain div. Can it be automated (like .live use) to sifr newly added h1 elements? (I thought about .live, but that is with an event like click). S.
[jQuery] Nice lightbox variant?
hi, I want to use a lightbox (clone) for showing forms (like login, register etc.). I looked at Lightbox and Simplemodal. Are there any other suggestions? Snef.
[jQuery] Re: Nice lightbox variant?
Facebook looks nice. Is it possible to darken the rest of the page like the other ligthbox clones? ;-) Joseph Le Brech schreef: facebox Date: Wed, 22 Apr 2009 05:10:29 -0700 Subject: [jQuery] Nice lightbox variant? From: sne...@gmail.com To: jquery-en@googlegroups.com hi, I want to use a lightbox (clone) for showing forms (like login, register etc.). I looked at Lightbox and Simplemodal. Are there any other suggestions? Snef. _ Share your photos with Windows Live Photos – Free. http://clk.atdmt.com/UKM/go/134665338/direct/01/
[jQuery] Handling html with javascript in .html()
When using $.ajax() i encounter some problems. With the ajax I'm calling a script that will return some html. When echoing the returned data, I can see that everything is returned including the javascript tags. When 'inserting' the returned data into a div on the screen, the javascript seems to be executed but i can't see it in the generated source! I cut it all down to some simple insertion of html into a div like this: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascriptalert(Bla);/ scriptpBla bla/p'); The html is inserted in #freediv but i can't see the script tags (although alert(Bla) did get executed). The real problem is when i try to use some jQuery in the html: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript$(#test).click(function (){ alert(Bla});/scriptpBla bla/p'); Isn't this possible at all? I'm using this to create some 'popup' forms (maybe with SimpleModal) and I want to include some javascript into the response that is specific for that form (like validation and other actions). I know i can use liveQuery or even jQuery's live() but then i need to have all the javascript for every used form already in the main document. I hope you understand my problem ;)
[jQuery] Re: Handling html with javascript in .html()
The 'problem' using .live() is that i need to have all the scripts loaded even when they are not used. I just wanted to have only the scripts related to that form. The check is either in 'view generated source' in FF and the dom inspector. I'm not sure about eval, sounds like evil ;) A simple alert is executed, but can not be seen in the source (and i think that;s why jQuery code doesn;t work). Also tried it to use the $(document).ready, without success. Jake schreef: I'd suggest .live() still. Or maybe you could try eval() those JavaScript code after Ajax fetch and DOM manipulation complete manually? btw, do you check the page source using `view page source' or firebug's dom inspector? latter recommended. On Apr 15, 3:56 pm, Snef sne...@gmail.com wrote: When using $.ajax() i encounter some problems. With the ajax I'm calling a script that will return some html. When echoing the returned data, I can see that everything is returned including the javascript tags. When 'inserting' the returned data into a div on the screen, the javascript seems to be executed but i can't see it in the generated source! I cut it all down to some simple insertion of html into a div like this: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascriptalert(Bla);/ scriptpBla bla/p'); The html is inserted in #freediv but i can't see the script tags (although alert(Bla) did get executed). The real problem is when i try to use some jQuery in the html: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript$(#test).click(function (){ alert(Bla});/scriptpBla bla/p'); Isn't this possible at all? I'm using this to create some 'popup' forms (maybe with SimpleModal) and I want to include some javascript into the response that is specific for that form (like validation and other actions). I know i can use liveQuery or even jQuery's live() but then i need to have all the javascript for every used form already in the main document. I hope you understand my problem ;)
[jQuery] Re: Handling html with javascript in .html()
Donny Kurnia schreef: Snef wrote: When using $.ajax() i encounter some problems. With the ajax I'm calling a script that will return some html. When echoing the returned data, I can see that everything is returned including the javascript tags. When 'inserting' the returned data into a div on the screen, the javascript seems to be executed but i can't see it in the generated source! I cut it all down to some simple insertion of html into a div like this: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascriptalert(Bla);/ scriptpBla bla/p'); The html is inserted in #freediv but i can't see the script tags (although alert(Bla) did get executed). What are you use for debugging? In Firebug, inserted javascript tag is not appear in the html tab, but it's executed. See the XMLHttpRequest in Console tab to verify the returned response is what you intended (html and the javascript code) The real problem is when i try to use some jQuery in the html: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript$(#test).click(function (){ alert(Bla});/scriptpBla bla/p'); Isn't this possible at all? It's possible. Just don't forget to wait the DOM loaded: $(#freediv).html('h1 id=testtest/h1'+ 'script type=text/javascript'+ 'jQuery(function($){'+ ' $(#test).click(function(){'+ ' alert(Bla);'+ ' });'+ '});'+ '/script'); Watch out for parentheses balance. Write it in indented to easily spot the missing parentheses. You code above missing ')' after alert; I'm using this to create some 'popup' forms (maybe with SimpleModal) and I want to include some javascript into the response that is specific for that form (like validation and other actions). I know i can use liveQuery or even jQuery's live() but then i need to have all the javascript for every used form already in the main document. I hope you understand my problem ;) I always use technique like this. My XMLHttpRequest to server will return html code and javascript code. It's working well. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia Donny, I have correct { } in my code locally ;) was just a typo. The problem is that when i use ajax I DO see the correct html in the response (even when outputting it to firebug with console.debug), but when inserting it with .html(data) (where data is the actual html/ javascript), the javascript tags are gone! That's why I just tried it with a clean .html(.) and there is my problem!
[jQuery] Re: Handling html with javascript in .html()
Well a tip to all. When having problems, first give your pc a nice reboot ;) Suddenly it is working :S Don;t know why, but it is. Thanx for all support! Snef schreef: Donny Kurnia schreef: Snef wrote: When using $.ajax() i encounter some problems. With the ajax I'm calling a script that will return some html. When echoing the returned data, I can see that everything is returned including the javascript tags. When 'inserting' the returned data into a div on the screen, the javascript seems to be executed but i can't see it in the generated source! I cut it all down to some simple insertion of html into a div like this: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascriptalert(Bla);/ scriptpBla bla/p'); The html is inserted in #freediv but i can't see the script tags (although alert(Bla) did get executed). What are you use for debugging? In Firebug, inserted javascript tag is not appear in the html tab, but it's executed. See the XMLHttpRequest in Console tab to verify the returned response is what you intended (html and the javascript code) The real problem is when i try to use some jQuery in the html: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript$(#test).click(function (){ alert(Bla});/scriptpBla bla/p'); Isn't this possible at all? It's possible. Just don't forget to wait the DOM loaded: $(#freediv).html('h1 id=testtest/h1'+ 'script type=text/javascript'+ 'jQuery(function($){'+ ' $(#test).click(function(){'+ ' alert(Bla);'+ ' });'+ '});'+ '/script'); Watch out for parentheses balance. Write it in indented to easily spot the missing parentheses. You code above missing ')' after alert; I'm using this to create some 'popup' forms (maybe with SimpleModal) and I want to include some javascript into the response that is specific for that form (like validation and other actions). I know i can use liveQuery or even jQuery's live() but then i need to have all the javascript for every used form already in the main document. I hope you understand my problem ;) I always use technique like this. My XMLHttpRequest to server will return html code and javascript code. It's working well. -- Donny Kurnia http://hantulab.blogspot.com http://www.plurk.com/user/donnykurnia Donny, I have correct { } in my code locally ;) was just a typo. The problem is that when i use ajax I DO see the correct html in the response (even when outputting it to firebug with console.debug), but when inserting it with .html(data) (where data is the actual html/ javascript), the javascript tags are gone! That's why I just tried it with a clean .html(.) and there is my problem!
[jQuery] Re: Handling html with javascript in .html()
I do not think it is due to $.ajax function. Even when using plain $ (#freediv).html(.) it won't work. (and I don't need json yet). András Csányi schreef: 2009/4/15 Snef sne...@gmail.com: I already tried it with the $(document).ready(function(){.}). No success. :( And through $.getJSON()? At night I can send you an string what is go through json into $(#foo).html(); András -- - - -- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell
[jQuery] Re: Handling html with javascript in .html()
András Csányi schreef: 2009/4/15 Snef sne...@gmail.com: When using $.ajax() i encounter some problems. With the ajax I'm calling a script that will return some html. When echoing the returned data, I can see that everything is returned including the javascript tags. When 'inserting' the returned data into a div on the screen, the javascript seems to be executed but i can't see it in the generated source! I cut it all down to some simple insertion of html into a div like this: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascriptalert(Bla);/ scriptpBla bla/p'); The html is inserted in #freediv but i can't see the script tags (although alert(Bla) did get executed). The real problem is when i try to use some jQuery in the html: $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript$(#test).click(function (){ alert(Bla});/scriptpBla bla/p'); Isn't this possible at all? I'm using this to create some 'popup' forms (maybe with SimpleModal) and I want to include some javascript into the response that is specific for that form (like validation and other actions). I know i can use liveQuery or even jQuery's live() but then i need to have all the javascript for every used form already in the main document. I hope you understand my problem ;) I understand because my application works fine and use this way (I hope this is the right expression at this case :$) So, in my application the html code with jquery source looks like this (I refactored your code upper): $(#freediv).html('h1 id=testtest/h1script language=javascript type=text/javascript -- this line! $(document).ready(function() { $(#test).click(function (){ alert(Bla}); -- this line! }) /scriptpBla bla/p'); Note that I'm using every case the $(document).ready(function(){--my code--}) part. Not so beaty but works! :D I suggest you try it this way. András -- - - -- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell I already tried it with the $(document).ready(function(){.}). No success. :(
[jQuery] jQuery $.ajax and dataType
Hi, When using the $.ajax functionality i came across some things. You have to set the dataType option in order to get the correct data at success(). Now I have an ajax request that can return some html or json. Both use the correct content-type header. Now I see in the httpData function of jQuery that it will get xml and in other occasions it will use the set dataType. Why not a check on content-type? In the httpData is a part like: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json ) data = window[eval](( + data + )); } Maybe it is possible to change it to: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script || ( !type ct.indexOf(javascript) = 0 ) ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json || ( !type ct.indexOf(json) = 0 ) ) data = window[eval](( + data + )); } (please check the httpData in jquery.1.3.2.js!) In this way, when dataType is omitted, it'll take a look at the returned content type. Offcourse, this is just a quick rewrite and maybe not even correct but with some simple tests it worked well. Snef
[jQuery] Re: jQuery $.ajax and dataType
Well, is it a good suggestion? Or maybe it's possible to override (or extends) tjhe current ajax implementation? On 10 apr, 16:45, Snef sne...@gmail.com wrote: Hi, When using the $.ajax functionality i came across some things. You have to set the dataType option in order to get the correct data at success(). Now I have an ajax request that can return some html or json. Both use the correct content-type header. Now I see in the httpData function of jQuery that it will get xml and in other occasions it will use the set dataType. Why not a check on content-type? In the httpData is a part like: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json ) data = window[eval](( + data + )); } Maybe it is possible to change it to: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script || ( !type ct.indexOf(javascript) = 0 ) ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json || ( !type ct.indexOf(json) = 0 ) ) data = window[eval](( + data + )); } (please check the httpData in jquery.1.3.2.js!) In this way, when dataType is omitted, it'll take a look at the returned content type. Offcourse, this is just a quick rewrite and maybe not even correct but with some simple tests it worked well. Snef
[jQuery] Re: jQuery $.ajax and dataType
Exactly what I also want! :) Think it needs minor update for 1.3.2 (different way of eval with json i think) Thanx! PS. Strange this was not included in jQuery itself. Mike Nichols schreef: I posted on this and submitted on the ticket tracker to do this but it seems to have been denied (it was abandoned). There was a suggestion made to use the dataFilter but that misses the point since the xhr header doesn't get included as a parameter. To work around this I have a little patch I add just after my jquery include. You can see it here : http://devlicio.us/blogs/mike_nichols/archive/2008/10/14/enabling-auto-detection-of-response-type-in-jquery.aspx On Apr 10, 3:39 pm, Snef sne...@gmail.com wrote: Well, is it a good suggestion? Or maybe it's possible to override (or extends) tjhe current ajax implementation? On 10 apr, 16:45, Snef sne...@gmail.com wrote: Hi, When using the $.ajax functionality i came across some things. You have to set the dataType option in order to get the correct data at success(). Now I have an ajax request that can return some html or json. Both use the correct content-type header. Now I see in the httpData function of jQuery that it will get xml and in other occasions it will use the set dataType. Why not a check on content-type? In the httpData is a part like: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json ) data = window[eval](( + data + )); } Maybe it is possible to change it to: // The filter can actually parse the response if( typeof data === string ){ // If the type is script, eval it in global context if ( type == script || ( !type ct.indexOf(javascript) = 0 ) ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == json || ( !type ct.indexOf(json) = 0 ) ) data = window[eval](( + data + )); } (please check the httpData in jquery.1.3.2.js!) In this way, when dataType is omitted, it'll take a look at the returned content type. Offcourse, this is just a quick rewrite and maybe not even correct but with some simple tests it worked well. Snef
[jQuery] Re: IE bug in the Tab plugin
Maybe it is in your IE settings (Tools - Internet options - General - Temp. Internet settings - Settings - Check for news version of stored pages) When it is on 'On every page visit' it will blink a lot. Setting it to 'Automaticly' will reduce (or eliminate) blinking. Remember that things will be cached when set to 'Automaticly'. Not always desired when developing! ;-) [EMAIL PROTECTED] schreef: Hi, There seems to be an issue with the Tab plugin in IE 6.0 ... Try it at jQuery doc page : http://docs.jquery.com/UI/Tabs When the mouse hover the tabs or when tabs are clicked, they disappear and there's a lot of blinking. It does not happen in Firefox. Is there a fix for that ? Thanks
[jQuery] Lightbox balupton
Hi, Playing around with the lightbox. Works nice! Only one 'little' problem though: When using it with IE6, the browser locks an the computer is having a hard time. I already tried to explicitly add ie6_support: true. I used css to hide the info box (and close link), that couldn't cause the problem I assume. Any ideas? Unfortunately I cant give a link to the page...
[jQuery] Re: Lightbox balupton
Also tried to remove the show_linkback option in the construction (read it in bug report). Now I only have the files option in the constructor. Also tried to use the non-packed version. Snef schreef: Hi, Playing around with the lightbox. Works nice! Only one 'little' problem though: When using it with IE6, the browser locks an the computer is having a hard time. I already tried to explicitly add ie6_support: true. I used css to hide the info box (and close link), that couldn't cause the problem I assume. Any ideas? Unfortunately I cant give a link to the page...
[jQuery] Re: pngFix or .width() problem
So what has changed? Still got the problem in 1.2.6. :( iZorg wrote: I have got the same problem. It began since version 1.2.2. So, if you can, use the jQuery version 1.2.1
[jQuery] Re: iFixPng issue in IE6 - red cross on image
I've got a problem that it will resize the image although it is not due to iFixPng but a wrong reading from .width(). In IE6 it read 120x120 while it is 124x124! (set in css, set as img attribute, image itself is 124x124). Still no solution to that one. Snef debussy007 wrote: Hi, I am using iFixPng for IE6 but I have a strange effect ont he image, it displays but there is a red cross on it, sample: http://r12121.ovh.net/~a6aresra/reining-merida.php Instruction: $('img[src$=.png]').ifixpng(); Thank you for any kind help !! -- View this message in context: http://www.nabble.com/iFixPng-issue-in-IE6---red-cross-on-image-tp17226936s27240p17226936.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: [PLUGIN] Excellent File Tree
Looks very well. Hoping that someone will include sorting ;-) Rey Bango wrote: Thanks to Karl Swedberg for pointing this jQuery-based File Tree out. http://abeautifulsite.net/notebook.php?article=58 Rey
[jQuery] Cycle plugin (Mike) problem
Hi, The 'cleartype' issue in IE does not only appear with the fade transition, but also with others. When you look at the demo: http://malsup.com/jquery/cycle/int2.html (No-Image Content demo), the slide numbered 1 has the cleartype issue. But only that slide! Not all. I'm using the slide where the container has a gradient background, so I cannot give the items a background color (that solves the cleartype issue). Is there another way to do this? The design of the site will be less nice when I can not use the gradient background. Thanx.
[jQuery] Re: Cycle plugin (Mike) problem
Hi Mike! That did the trick! Thanks for that! (and for the very quick reply!) And also thank you for implementing the continuous property! :) Mike Alsup wrote: The 'cleartype' issue in IE does not only appear with the fade transition, but also with others. When you look at the demo: http://malsup.com/jquery/cycle/int2.html (No-Image Content demo), the slide numbered 1 has the cleartype issue. But only that slide! Not all. I'm using the slide where the container has a gradient background, so I cannot give the items a background color (that solves the cleartype issue). Is there another way to do this? The design of the site will be less nice when I can not use the gradient background. If you don't want the bg color to change then use this option: cleartypeNoBg $('#slideshow').cycle({ cleartype: true, cleartypeNoBg: true }); Mike
[jQuery] Re: Cycle plugin (Mike) problem
Too fast replied It still has some strange behaviour. Now only the first slide when showed for the first time will look bad. When it is showed in the 'next cycle' it will be displayed correctly. Any ideas? Mike Alsup wrote: The 'cleartype' issue in IE does not only appear with the fade transition, but also with others. When you look at the demo: http://malsup.com/jquery/cycle/int2.html (No-Image Content demo), the slide numbered 1 has the cleartype issue. But only that slide! Not all. I'm using the slide where the container has a gradient background, so I cannot give the items a background color (that solves the cleartype issue). Is there another way to do this? The design of the site will be less nice when I can not use the gradient background. If you don't want the bg color to change then use this option: cleartypeNoBg $('#slideshow').cycle({ cleartype: true, cleartypeNoBg: true }); Mike
[jQuery] pngFix or .width() problem
Hi, I'm using pngFix and I'm running into some weird thing. I have a .png file (logo.png) . Dimensions: w: 124px, h: 124px. When doing the pngFix, the dimensions are altered to 120/120. It seems that width property of the image will return 120, but it in fact is 124px! Within the pngFix, the .width is used to determine the with of the .png $(#logo img).width() == 120 $(#logo img).attr(width) == 124 Used html: div id=logoa href=#img src=logo.png //a/div Used css: #logo { width: 124px; height: 124px; position: relative; } #logo img { width: 124px; height: 124px; } What can I do?
[jQuery] Superfish menu
Hi, I'm playing with the superfish menu. Looks fine! I want to have my sub-submenu's shifted a little bit to the left, so that it is a bit over its parent menu. I altered this part: .nav li li:hover ul, ul.nav li li.sfHover ul { left:9.45em; top:-1px; } to .nav li li:hover ul, ul.nav li li.sfHover ul { left:8.45em; top:-1px; } The sub-submenu is shifted to the left, only the middle items seem to fall under it parent! Tried some z-indexing, but i can not get it right. Anyone? (just used the default example with its css). Snef
[jQuery] Re: Strange bold look after a show in IE6
Try to use a background Olivier Percebois-Garve wrote: Hi all, I'm using animate({opacity: 1}); It produces a strange effect on IE6 where the text appears sort of bold (or sort of duplicated) and a little dirty. With show() I see this effect during the transition, but when it is finished it looks ok. With animate({opacity: 1}); it remains dirty after the effect. Anybody experienced this ? Any know fix or workaround ? thanks -Olivier
[jQuery] Re: Zebra striping in tables
Karl, Thank you! This is what I was looking for! Karl Swedberg schreef: One way to solve your dilemma is to use tr:nth-child(even). That will select all table rows that are an even child of their parent element. This should work: $(table tr:nth-child(even)).css(background, #cc); --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 4, 2008, at 5:38 PM, Snef wrote: Hi, I know how to do some 'zebra-striping' on tables with jQ, but i have a little problem. I have some (unknown amount) tables om a page and I want to 'stripe' the tables seperately, so that all striping is the same in each table. With a simple: $(table tr:even).css(background, #cc) the rows are counted over all the tables and I want to start counting (for even and odd rows) for every table, so i tought: $(table).each(function() { // how to get the rows here??? }) How do I do this? (I do not know on forehand how many or which tables are on the page)
[jQuery] Re: Zebra striping in tables
Karl, Again, many thanks. Only just one question... I have used your one-liner like this: $(table tr:nth-child(even)).css(background, #cc); I played around with the :not(:first) to eliminate the first row of each table but i do not get it working. Is this possible to use this, or is it better to just change all the firstrows after yoour one- liner? (at the end, i can use a special classname for the first row, but I'm curious to know if it can work without it!) Karl Swedberg schreef: One way to solve your dilemma is to use tr:nth-child(even). That will select all table rows that are an even child of their parent element. This should work: $(table tr:nth-child(even)).css(background, #cc); --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 4, 2008, at 5:38 PM, Snef wrote: Hi, I know how to do some 'zebra-striping' on tables with jQ, but i have a little problem. I have some (unknown amount) tables om a page and I want to 'stripe' the tables seperately, so that all striping is the same in each table. With a simple: $(table tr:even).css(background, #cc) the rows are counted over all the tables and I want to start counting (for even and odd rows) for every table, so i tought: $(table).each(function() { // how to get the rows here??? }) How do I do this? (I do not know on forehand how many or which tables are on the page)
[jQuery] Re: Zebra striping in tables
Allex, This is what I was thinking of but couldn't get my hands on the 'find'. Your solutions works, but I think I go for Karls solution (a one- liner). Thank you! Smith, Allex schreef: Couldn't you just use $(this) and then do whatever selector? $(table).each(function() { $(this).find('tr:even').css(background-color, #ff); }); Maybe I don't understand the question. Allex -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Snef Sent: Monday, February 04, 2008 2:38 PM To: jQuery (English) Subject: [jQuery] Zebra striping in tables Hi, I know how to do some 'zebra-striping' on tables with jQ, but i have a little problem. I have some (unknown amount) tables om a page and I want to 'stripe' the tables seperately, so that all striping is the same in each table. With a simple: $(table tr:even).css(background, #cc) the rows are counted over all the tables and I want to start counting (for even and odd rows) for every table, so i tought: $(table).each(function() { // how to get the rows here??? }) How do I do this? (I do not know on forehand how many or which tables are on the page)
[jQuery] Re: Zebra striping in tables
Yes, I know! ;) Thanks! Smith, Allex schreef: Rob definitely has the best answer here. Structure your table like so: table captionCaptions are good/caption thead tr thheader/th throw/th /tr /thead tfoot tr tdfooter/td tdrow/td /tr /tfoot tbody tr tdrow/td tdone/td /tr tr tdrow/td tdtwo/td /tr /tbody /table Then you don't have to worry about the checking for the first row and it will not be part of your structure. Allex -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of RobG Sent: Tuesday, February 05, 2008 5:06 AM To: jQuery (English) Subject: [jQuery] Re: Zebra striping in tables On Feb 5, 7:57�pm, Snef [EMAIL PROTECTED] wrote: Karl, Again, many thanks. Only just one question... I have used your one-liner like this: $(table tr:nth-child(even)).css(background, #cc); I played around with the :not(:first) to eliminate the first row of each table but i do not get it working. Is this possible to use this, or is it better to just change all the firstrows after yoour one- liner? (at the end, i can use a special classname for the first row, but I'm curious to know if it can work without it!) Consider putting your header rows in a thead element, then use: $(tbody ... -- Rob
[jQuery] Zebra striping in tables
Hi, I know how to do some 'zebra-striping' on tables with jQ, but i have a little problem. I have some (unknown amount) tables om a page and I want to 'stripe' the tables seperately, so that all striping is the same in each table. With a simple: $(table tr:even).css(background, #cc) the rows are counted over all the tables and I want to start counting (for even and odd rows) for every table, so i tought: $(table).each(function() { // how to get the rows here??? }) How do I do this? (I do not know on forehand how many or which tables are on the page)