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 flashes quickly in Firefox then disappears, I'm currently working on Windows XP SP2.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$("a").click(function() {
var field_id = $(this).attr("href");
$(field_id).focus();
});
});
</script>
<a href="#text_field">Focus</a>
<input type="text" name="text_field" id="text_field" />
Does anyone know how to handle the above in Firefox?
You could also be more explicit and call
preventDefault
on the event arg.