触发焦点:
$("Element").focus()
触发每一个匹配元素获得焦点事件。
$("Element").focus(function)
事件会在获得焦点的时候触发,既可以是鼠标行为,也可以是按tab键导航触发的行为,并且绑定一个处理方法。
失去焦点:
$("Element").blur()
触发每一个匹配元素失去焦点事件。
$("Element").blur(function)
事件会在元素失去焦点的时候触发,既可以是鼠标行为,也可以是按tab键离开的行为,并且绑定一个处理方法。
例子一
$(document).ready(function(){
$(".regbox .textb").bind("focus",function(){});
$(".regbox .textb").bind("blur",function(){});
$("input").css({"background-color":"#fff3de"});
//if (screen.width>=1280){}else if (screen.width<1280){}
})
例子二