如何在mozilla firefox中使用focus()事件?

时间:2015-02-27 05:13:06

标签: html asp.net

我使用过focus()方法,但它不适用于Mozilla Firefox。我在asp .net中使用了以下代码:

protected void drgBranches_SelectedIndexChanged(object sender, EventArgs e)
{
  txtLoginName.Text = drgBranches.SelectedValue;
  txtLoginName.Focus();
}

1 个答案:

答案 0 :(得分:2)

你可以只定期关注

<input id="target" type="text" value="Field 1">

$("#target").focus(function() {
  alert( "Handler for .focus() called." );
});

https://jsfiddle.net/3o11wnus/