textarea上的jQuery .focus()无效

我有这个代码
<textarea id="status" placeholder="Write here..." name="new_entry"></textarea>

还有这个:

$('#status').focus(function() {
    alert('focused!');
});

我希望在textarea专注时启动警报,但它不起作用……

解决方法

Here’s the working fiddle.

HTML

<textarea id="status" placeholder="Write here..." name="new_entry"></textarea>

JS

$('document').ready(function(){
    $('#status').focus(function() {
        alert('focused!');
    });
});

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...