Thanks - funnily enough i downloaded firebug earlier on today.
Also, what's Sean talking about when he says:
lets say the focus function gets called twice (through
malicious javascript or a quirky browser) then the toggle state of the
class will be off. But in general I prefer your
On Apr 17, 2007, at 2:25 AM, Klaus Hartl wrote:
$(function(){
var toggle = function() { $(this).parent().toggleClass('on') };
$('fieldset).find('input, select, textarea').focus(toggle).blur
(toggle);
});
I'd choose this approach in order to avoid typing the class name
on in more
Also, what's Sean talking about when he says:
lets say the focus function gets called twice (through
malicious javascript or a quirky browser) then the toggle state of the
class will be off. But in general I prefer your implementation.
Is this something i need to worry about? Is this
Thanks guys. Very helpful.
So, which would be faster...
$(fieldset input, fieldset select, fieldset textarea)
or
$(fieldset).find(intput,select,textarea)
Thanks x 1,000,000
Karl Rudd wrote:
You're on the right track.
Yes you can join (or chain) the focus and blur functions together.
Off hand I'd have to say Sean's is faster, since it's only searching for
every fieldset in the document once instead of three times like yours
(unless jQuery does some result caching that I'm not aware of, in which case
the difference is probably negligible). But, as Karl said, you'd really have
5 matches
Mail list logo