Javascript 未触发JQuery.blur
当输入字段失去焦点时,我尝试(服务器-)验证它。但当输入字段失去焦点时不会发生任何事情,警报不会触发 我的代码,php文件:Javascript 未触发JQuery.blur,javascript,jquery,html,Javascript,Jquery,Html,当输入字段失去焦点时,我尝试(服务器-)验证它。但当输入字段失去焦点时不会发生任何事情,警报不会触发 我的代码,php文件: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?ph
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php header('Content-Type: text/html; charset=ISO-8859-1');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Origin: *');?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language='javascript' type='text/javascript' src="jquery-1.6.2.min.js"></script>
<script language='javascript' type='text/javascript' src="smicadminjavascripts.js"></script>
<title>Service Management In the Cloud - Administration</title>
</head>
<body>
<div id="adminmenu">
<a id="agents" class="adminmenu_items">Agenter</a></br>
<a id="customer" class="adminmenu_items">Kunder</a></br>
<a id="misc" class="adminmenu_items">Övrigt</a></br>
</div>
<div id="adminarea">
</div>
</body>
</html>
.ready函数中的其他脚本工作正常
问题是什么?我如何解决它?它对我很有效
- 点击用户名
- 回到我的岗位
- 警报响起李>
您可以使用.focusout()
并且不要忘记包含jquery库。首先尝试聚焦,然后模糊它。。在这里工作:您的意思是:$(“#用户名_ID”)。聚焦(函数(数据){}?没有区别。没有触发。工作正常,但您的BRs是错误的,您必须在BR字符后附加结束斜杠,或者根本不关闭它。您确定这是正确的文件吗?您甚至没有包括jQuery。用整个文件更新了帖子。您忘了包括jQuery库实际上,它包括在内。我添加的文件只是一个文件提取,不会再这样做了…表单将动态加载到网页中。这有关系吗?谢谢!这就是问题所在。
$(document).ready(function() {
$("#username_ID").blur(function(data){
alert("BLUR");
});
$.get("registeraccount.php", function(data){
$("#adminarea").html(data);
});
$("#registerform").live("submit", function(e){
e.preventDefault();
$.post("registeraccount.php",$(this).serialize(),function(msg){
alert(msg);
});
});
});
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>