HTML:为什么 Firefox 不使用 wrap=“off”什么时候由 JavaScript 设置?

发布于 2024-08-19 10:53:51 字数 429 浏览 4 评论 0原文

我正在使用这个:

$('document').ready(function(){
    $('textarea').attr('wrap', 'off');
});

(JQuery) (Firefox 3.5)

我正在向 WebDeveloper 检查,当我加载页面时,换行属性确实在页面中设置为关闭,但文本仍然换行。如果我将 wrap="off" 的无效 HTML 硬编码到 HTML 中的

I'm using this:

$('document').ready(function(){
    $('textarea').attr('wrap', 'off');
});

(JQuery) (Firefox 3.5)

I'm checking with WebDeveloper that the wrap attribute indeed is set to off in the page when I'm loading it up, but the text still wraps. If I hard-code the invalid HTML of wrap="off" into the <textarea> in my HTML, it works fine, but this is invalid HTML and I'm not interested in doing that. When using spellcheck="false" in JavaScript you actually have to pass it the keyword false instead of a string "false". I tried to apply this same principle using false instead of "off", but it didn't work.

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

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

发布评论

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

评论(1

鸢与 2024-08-26 10:53:51

这似乎是 Firefox 和 Opera 中发生的现象。请参阅此问题

This seems to be a phenomenon happening with Firefox and Opera. See this question

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