我通过在键盘中输入回车键来验证文本框。验证工作正常,但JAlert没有显示。但是当我在按钮上调用相同的功能时,它会在IE中显示警报。我完全对此感到困惑。谁能帮我? demo
function isEnterPressed(event) {
var keynum;
if (window.event) {
keynum = event.keyCode;
}else if (event.which) {
keynum = event.which;
}
if(keynum == 13) {
searchSubmit();
}
}
searchSubmit()是按钮单击时的函数调用
function searchSubmit()
{
// some valdation
if(!flag)
{
alert('flag'+flag);
jAlert("Enter anyone of the value to search");
return false;
}else{
document.userManagementUsers.action=baseUrl;
document.userManagementUsers.submit();
}
}
通过单击输入键显示alert('flag'+ flag)jalert未执行。
答案 0 :(得分:0)
你尝试过这样的事吗?
$('body').jAlert('Enter anyone of the value to search', 'success');
或
$(document).ready(function() {
$('body').jAlert('Enter anyone of the value to search', "success");
});