The following piece of code focuses the text input after you click on the link. It works fine for Chrome 2.x, IE8 and Opera 9.64 but not on Firefox 3.0.9. The text input f
I think this error in FF is occurring because after you click the link it runs the click callback and after that it opens the page#textfield. You can try:
$(document).ready(function()
{
$("div").click(function() {
var field_id = $(this).attr("forInput");
$(field_id).focus();
});
});
</script>
<div forInput="#text_field">Focus</div>
<input type="text" name="text_field" id="text_field" />
This way there is no link and will not open another page.