Jquery的基本语法:
$("input[type='text']").change( function() {
// 这里可以写你想要的验证代码;
});2 当绑定一个文本框的时候
$(function () {
$("#txtAssessmentTotal").change(function () {
//这里写你想要的验证的代码;
})
})
为每个匹配元素的特定事件绑定事件处理函数。
.bind() 方法是用于往文档上附加行为的主要方式。所有JavaScript事件对象,比如focus, mouseover, 和 resize,都是可以作为type参数传递进来的。
个人理解bind就是为这个控件绑定事件在给这个事件定义一个匿名的方法去实现你想要的验证;
Jquery基本语法:
$("#txtAssessmentTotal").bind('click', function() {
alert($("#txtAssessmentTotal").val());
});
2 多个事件:事件的名称用空格隔开;
$("#txtAssessmentTotal").bind('mouseenter mouseleave', function() {
alert($("#txtAssessmentTotal").val());
});
Copyright © 2019- vc-talk.com 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务