JQuery Live 更改 TextArea 的 FocusOut 事件未触发

发布于 2024-12-26 16:12:46 字数 283 浏览 2 评论 0原文

似乎无法找到一种方法来对文本区域的输入类型进行更改或聚焦,尝试了很多不同的方法,但到目前为止没有任何效果...这是我当前的迭代,也不起作用...

我是使用最新的 jquery 版本。

$('input[type="text"],input[type="textarea"]').live(
     'change focusout', function (e) 
    {
        debugger;
        alert('text area');
    });

cannot seem to find a way to get change or focusout to fire for a input type of textarea, tried a lot of different things and nothing is working thus far... this is my current iteration that does not work either...

I am using latest jquery release.

$('input[type="text"],input[type="textarea"]').live(
     'change focusout', function (e) 
    {
        debugger;
        alert('text area');
    });

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下雨或天晴 2025-01-02 16:12:46

描述

Textarea 不是一个输入元素,它是一个 textarea ;) 查看我的示例和这个 jsFiddle 演示

示例

Html

<input type="text"/>
<textarea></textarea>

jQuery

$('input[type="text"], textarea').live(
     'keyup focusout', function (e) 
{
    alert(this.tagName);
});

更多信息

更新

我不知道这是否是您想要的,但看起来您希望在值更改或焦点丢失时触发该事件。我的示例和 jsFiddle 已更新。

Description

Textarea is not an input element, it is a textarea ;) Check out my sample and this jsFiddle Demonstration

Sample

Html

<input type="text"/>
<textarea></textarea>

jQuery

$('input[type="text"], textarea').live(
     'keyup focusout', function (e) 
{
    alert(this.tagName);
});

More Information

Update

I don't know if that is what you want but it looks like you want the event fired if the value is changed or the focus is lost. My sample and jsFiddle is updated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文