日期:2014-05-16  浏览次数:20330 次

jQuery foucs blur 问题
今天做了一个jQuery表单,想捕获表单事件,代码如下:
jQuery代码:
<script src="js/jquery-1.9.1.js"></script>
<script>
    $(document).ready(function(){
$('pubshuoshuo_content').bind({
focus:function(){
        $('this').css('border','1px solid #f00');
},
                      blur:function(){
         $('this').css('border','none');
},
});

         });
</script>
htnl代码: 
<textarea id="pubshuoshuo_content" name="pubshuoshuo_content" rows="7" cols="83"></textarea>
浏览器浏览效果为什么没有效果!!
------解决方案--------------------
根据ID获取元素  #
$('#pubshuoshuo_content')
------解决方案--------------------

$('#pubshuoshuo_content').bind({
    focus:function(){
            $(this).css('border','1px solid #f00');
     },
        blur:function(){
             $(this).css('border','none');
     }
 });

------解决方案--------------------
 $(document).ready(function(){
    $('#pubshuoshuo_content').bind(
        'focus',function(){
            $(this).css('border','1px solid #f00');
        }). bind('blur',function(){
            $(this).css('border','none');

    });

  });