I want a JQuery function that means if the user clicks on some text on the page it focuses an input.
$(document).ready(function(){
$('#header.search span').click(function(){
$('#header.search input').focus();
});
});
That did not do anything. On Firebug nothing is registered.
Any ideas?
Marvellous
http://jsfiddle.net/HenryGarle/LXngq/
<span>
<br>
Span
<br>
<input id="InputToFocus" type="text">
</span>
$('span').click(function(){
$('#InputToFocus').focus();
});
Seems to be working fine, It is probably a problem with your selectors. Could you post the structure of your HTML surrounding the input?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With