文本在Google网上论坛中设置,邮件正文但不显示? [英] Text gets set in Google Groups, post-message body but does not display?

查看:177
本文介绍了文本在Google网上论坛中设置,邮件正文但不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的扩展程序在内容脚本中写入Google Groups新主题页面的主题和消息正文。

更新后的主题显示得很好;它是输入类型文本,所以一切都很简单。但是,body是一个表示TextBox的div,当我写入时,更新不会出现:





我尝试将焦点置于首位,但没有任何效果。

解决方案

您如何设置文本? 显示您的代码!



最初设置 contenteditable 元素的典型方式如下所示:

  var messageBody = document.getElementById(pb-0); 
messageBody.innerHTML ='< p>第1行。< / p>< p>第2行。< / p>';






请注意,使用 innerHTML 可以清除以前可能在文本框中的任何内容 - 对于这个问题的场景,这是可以的。



(对于更高级的更改/编辑,加载jQuery并使用它来添加/删除/替换编辑框中的节点,但是,这是一个不同的搜索和/或问题的主题。)


My extension, in a content script, writes to the subject and message body of the Google Groups "New Topic" page.

The updated subject is displayed just fine; it's of input type "text", so everything is easy. The body, however, is a div representing a TextBox, and when I write to it, the update doesn't appear:

(Click for a larger image.)


I tried setting the focus to the field first, but that had no effect.

解决方案

How are you trying to set the text? Show your code!

A typical way to initially set a contenteditable element is like so:

var messageBody         = document.getElementById ("p-b-0");
messageBody.innerHTML   = '<p>Line 1.</p><p>Line 2.</p>';


Note that using innerHTML erases anything that might have been on the textbox before -- which is okay for this question's scenario.

(For more advanced changes/edits, load jQuery and use it to add/delete/replace nodes inside the edit box. But, that is a subject for a different search and/or question.)

这篇关于文本在Google网上论坛中设置,邮件正文但不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆