[jQuery] Re: input has focus

2009-08-10 Thread James
You can still use the same technique but just not use jQuery to do it. On Aug 10, 10:09 am, MartinBorthiry wrote: > On 10 ago, 16:49, "Dan G. Switzer, II" > wrote: > > > You can add a class to your field when it has focus and then check for the > > class: > > $(":input") > > // add focus/blur e

[jQuery] Re: input has focus

2009-08-10 Thread MartinBorthiry
On 10 ago, 16:49, "Dan G. Switzer, II" wrote: > You can add a class to your field when it has focus and then check for the > class: > $(":input") > // add focus/blur events > .focus(function (){ > $(this).addClass("has-focus");}) > > .blur(function (){ > $(this).removeClass("has-focus"); > > })

[jQuery] Re: input has focus

2009-08-10 Thread Dan G. Switzer, II
You can add a class to your field when it has focus and then check for the class: $(":input") // add focus/blur events .focus(function (){ $(this).addClass("has-focus"); }) .blur(function (){ $(this).removeClass("has-focus"); }); Now you can just do $("input#1").is(".has-focus") to check if it has