Patrick Hall schrieb:
> Hellos,
> 
> http://ruphus.com/code/js/focusdebug/dropdown.html
> 
> I'm trying to debug a problem with focus and Firebug, and I really
> can't figure out what's causing the problem. The samples in that demo
> are variations on this theme:
> 
>     $('#clickme').click(function(){
>         $('#yourname').get(0).focus();
>         return false;
>     });
> 
> <a href="#" id="clickme">click to fill out form</a>
> <div  id="one" class="dropdown"><strong>your name:</strong> <input
> id="yourname"></div>
> 
> Focusing works only sporadically.
> 
> For a while I thought the problem had to do with the fact that the
> input I wanted to focus was revealed by a slideDown, or then that it
> had to do with a need for a timeout; hence to the other three variants
> in my demo. '
> 
> But at this point I'm just thinking it's some sort of weird Firefox
> bug. (It works in Opera, haven't tested elsewhere.)
> 
> Anyone run into this?
> 
> -p@
> 

Patrick,

Try using a label. That way you have the focus on click build-in without 
JavaScript in all browsers except for Safari. As a bonus you will 
improve accessibility and can get rid of an obtrusive anchor:

<label for="yourname">click to fill out form</label>
<div id="one" class="dropdown">
     <label><strong>your name:</strong></label>
     <input id="yourname">
</div>


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to