[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Ⓙⓐⓚⓔ
  is html. not javascript! Does IE do this any differently than firefox? http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en"> nbsp; $(function(){ var x = " " alert(x.le

[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Karl Swedberg
Michael! So great to see you on the list again! You have a brilliant mind, and I always learn something new whenever you post. I was beginning to wonder where you've been. Glad to have you back. :-) --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 2

[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Ian Struble
On 4/28/07, Michael Geary <[EMAIL PROTECTED]> wrote: Indeed there is, return false. See my #1 example which is similar to yours... I should have used my eyes before I started typing. My question's code is almost exactly what you wrote, just cosmetic differences. I missed the assignment + ret

[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Michael Geary
> From: Ian Struble > Just out of curiosity is there a way to break out while > iterating with .each()? Again building on the previous > example (Mike's #2 this time): > > $(function() { >$('tr').each( function() { >var allEmpty = true; >$('td', this).each(funcion() { >

[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Ian Struble
[...] isn't there a big performance impact using this piece of code? That's why I said play around a bit ;^) I threw that idea out there mostly because it is sort of inside-out from style that I would probably have tried first and it was just building off the previous example. That sort of t

[jQuery] Re: Interacting with TR an TD

2007-04-28 Thread Feed
Hey Mike, thanks for you answers... your code is being executed much faster, thanks! I just changed this: var $td = $('td',this); to var $td = $('td:gt(1)',this); Because I want to exclude the first TD from the checking. Right now it's conflicting with another line of code that "stripes" (zeb

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Michael Geary
> From: Feed > > Thanks Ian, it seem to be working perfectly. I just have one more > question: isn't there a big performance impact using this > piece of code? It looks like the page it taking a while do > load, but I guess you have to choose between the time the > page takes to load and the t

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Michael Geary
That's very clever, Ian, I like that! Here's another approach that uses a variable instead of the temporary class: $(function() { $('tr').each( function() { var empty = true; $('td',this).each(function() { if( $(this).html() !== ' ' ) return empty

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Feed
Thanks Ian, it seem to be working perfectly. I just have one more question: isn't there a big performance impact using this piece of code? It looks like the page it taking a while do load, but I guess you have to choose between the time the page takes to load and the time you take to do everything

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Feed
Thanks Ian, I'll play around with this piece of code! jQuery is really helping me in my project, it's awesome. On Apr 28, 1:20 am, "Ian Struble" <[EMAIL PROTECTED]> wrote: > Building on Karl's example and your new all-td's-must-be-empty > requirement; mark all the TR's with a target class then sw

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Ian Struble
Building on Karl's example and your new all-td's-must-be-empty requirement; mark all the TR's with a target class then sweep through the TD's and get rid of the target class if you find a td that is not empty. Play around a bit and see what else you can come up with. Ian $(document).read

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Feed
Feed wrote: > Hello all, I'm getting used to the excellent jQuery library and I need > some help of more experienced programmers. I have this simple table: > > > > content > content > content > > >   >   >

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Karl Swedberg
This should do the trick, although there's probably a way to do it without the .each(), too. $(document).ready(function() { $('td').each(function() { var $this = $(this); if ($this.html() == ' ') { $this.parent().addClass('some-class'); } }); }); --Karl _

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Mike Alsup
You could create a new pseudo-selector like this: jQuery.extend(jQuery.expr[':'], { blank: "jQuery.fn.text.apply([a])=='\u00a0'" }); And then use it to find the desired rows like this: var rows = $('td:blank').parent(); Mike What I need is to add a class to the TRs that have children TD

[jQuery] Re: Interacting with TR an TD

2007-04-27 Thread Ⓙⓐⓚⓔ
  is html-speak. "'\u00a0" is JavaScript-speak. On 4/27/07, Feed <[EMAIL PROTECTED]> wrote: Hello all, I'm getting used to the excellent jQuery library and I need some help of more experienced programmers. I have this simple table: content content