Maybe can four words   less

$('#the_id_of_the_input')[0].focus();


Klaus Hartl 写道:
Roberto Ortelli schrieb:
  
Hello,
A few weeks ago I've written a small plugin for that:

$.fn.fieldFocus = function(id){
	document.getElementById(id).focus();
}

and you call it using:
$(document).fieldFocus("the_id_of_the_input_field_without_#");
    

That is exactly the same as if you were doing this:

$('#the_id_of_the_input').get(0).focus();

And that's two lines less ;-)


-- Klaus

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


  

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

Reply via email to