如何调后的文本框失去焦点功能 [英] How to call a function after textbox lose focus

查看:146
本文介绍了如何调后的文本框失去焦点功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的JavaScript / JQuery的/ AJAX没有经验,所以我想了解是否有可能调用一个文本框后执行一个查询我的数据库失去焦点的功能。

我在我的网页上显示的表(使用PHP)的文本框,包含在我的数据库表中的值相同,当有人更改文本框中的值我想更改数据库表与UPDATE查询,使他们平等;是用AJAX或JQuery的一个办法做到这一点?

解决方案

 <输入类型=文本ID =检查>

&所述;脚本的src =htt​​ps://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js>&所述; /脚本>

<脚本类型=文/ JavaScript的>
$(#检查)。模糊(函数(){
 警报('工作');
});
< / SCRIPT>
 

I have no experience with Javascript/JQuery/AJAX so I'm trying to understand if it's possible to call a function that execute a query on my DB after a textbox lose focus.

I'm displaying a table in my page (using PHP) with text boxes that contains the same values of a table on my DB, and when someone change the value on a text box I want to change the DB table with an UPDATE query to make them equals; is that a way with AJAX or JQuery to do this?

解决方案

<input type="text" id="check">​

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<script type="text/javascript">
$("#check").blur(function() {
 alert('working');
});​
</script>

这篇关于如何调后的文本框失去焦点功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆