概述
//事件绑定简写
/**
$(function(){
/**$('input').click(function (argument) {
alert('click');
});
*/
/**
$('input').mousedown(function (argument) {
alert('mousedown');
})
*/
/**
$('input').mouseleave(function (argument) {
// body...
alert('mouseleave');
})
*/
/**
$(window).resize(function (argument) {
// body...
alert('size change');
})
*/
/**
$(window).scroll(function (argument) {
// body...
alert('scroll');
})
*/
/**
$('input').select(function (argument) {//select是当选中文本内时触发事件
// body...
alert('select');
})
*/
/**
$('input').change(function (argument) {//当文本中的内容被改变时触发事件
// body...
alert('change');
})
*/
/**
$('form').submit(function (argument) {
// body...
alert('submit');
})
*/
/**
$('input').keydown(function() {
alert('按下');
});
*/
/**
$('input').keyup(function() {//输入的值立即显示在文本框上
alert('抬起');
});
*/
/**
$('input').keypress(function(){//输入的内容在关闭弹框后才显示在文本框上
alert('按下');
});
*/
/**
$('input').keypress(function(event){
//charCode 返回onkeypress事件触发键值的字母代码。
alert(event.charCode);
});
*/
/**
$('input').keydown(function(event){
// keyCode 返回 onkeydown 或 onkeyup 事件的键的代码。
alert(event.keyCode);
});
*/
/**
$('input').focus(function(){//会一直获得焦点,需要是具体的标签,如父标签就不行
alert('获得焦点');
});
*/
/**
$('input').blur(function(){//当获得焦点后点击其他位置即可失去焦点
alert('失去焦点');
});
*/
/**
$('div').focusin(function(){//会一直获得焦点,不需要是具体的标签,如父标签
alert('focusin');
})
*/
/**
$('div').focusout(function(){//会一直获得焦点,不需要是具体的标签,如父标签
alert('focusout');
})
*/
})
*/
最后
以上就是爱笑香菇为你收集整理的jQuery基础事件-事件简写的全部内容,希望文章能够帮你解决jQuery基础事件-事件简写所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复