在jAlert之后设置焦点

时间:2015-04-06 13:03:58

标签: javascript jquery jquery-plugins

我正在使用jQuery插件 jAlert 来显示提示框。

我希望在显示jAlert之后关注文本框,如下所示:

jAlert("Error", "Please enter EmailID.", function(){
  document.getElementById('txtEmail').focus();
}, 1);

但是,此代码不会等待用户单击“确定”按钮,文本框会在单击“确定”按钮之前获得焦点。

所以如何在用户点击后关注它,比如回调函数。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

jAlert不像JavaScript警报一样运行,jAlert有一个回调函数,并从enter link description here

获取参考
 $("#txtEmail").focus();
相关问题