这就是我的尝试:
$(document).ready(function() {
/*$('textarea').focus(function() {
alert('IN!');
});*/
/*$('.mensagem').focusout(function() {
alert('OUT!');
});*/
/*$('textarea').blur(function(){
alert('OUT!');
});*/
/*$('textarea').on('focusout',function(){
alert('OUT!');
});
$('textarea').on('focus',function(){
alert('IN!');
});*/
$('textarea').focus(function() {
alert('IN!');
}).blur(function() {
alert('OUT!');
});
});
当我进入textarea时会发生什么,它首先警告“OUT!”然后“IN!”。
编辑:
我认为做出此测试的警报是个坏主意......
$('textarea').bind('focus', function() {
$(this).css({
'background-color':'#E18B6B'
});
}).blur(function() {
$(this).css({
'background-color':'#990012'
});
});
现在我可以看到它正在发挥作用。谢谢大家。