On Nov 30, 2007, at 9:57 PM, Rob_ wrote:
So, in your situation, you can do this:
$("dt.current").next('dd').addClass("show")
Makes me blush, thank you ;-)
Maybe I'm looking for solutions to deeply...
BTW: any useful philosophy behind your use of single and double
quotes?
I assume you can mix them to taste, but I'm not always sure if I see
pros writing it like you did.
But maybe pros are human too... ;-)
Hi Rob,
---I wrote this once already, but my email app ate it for dinner. ---
The single versus double quote thing is largely a matter of taste.
From what I've seen of John Resig's code, it looks like he uses
double quotes -- he's the pro, not me. :-)
I use single quotes for convenience and consistency. Because I
sometimes insert HTML markup inside the $(), I can use single quotes
to wrap everything and then double quotes for attributes, without
having to escape anything. For example, if I'm creating a div with
class of "happy," I can do this:
$('<div class="happy"></div>')
If I had used double quotes, I'd have to either use single for
"happy," which I don't think is even valid xhtml, or escape its double
quotes, which feels cumbersome to me. So, it would look like this:
$("<div class='happy'></div>")
or this:
$("<div class=\"happy\"></div>")
There are probably good, sound reasons for double quoting, too. I'd
say that whichever you choose, it's probably best to maintain
consistency within your own script.
Cheers,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com