如何在< div>中粘贴文本镀铬扩展? [英] How to paste text in <div> with chrome extension?

查看:62
本文介绍了如何在< div>中粘贴文本镀铬扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用chrome扩展名将一些预定义的文本粘贴到网站的文本框中.目标网站是 https://www.urlgot.com/.这是一个看似简单的网页,只有一个输入文本框.我找到了一个解决方案以获取我感兴趣的DOM内容.但是,如何操纵DOM将我的文本粘贴到占位符"中呢? 作为chrome扩展脚本编写的新手,我真的需要一些建议.

I would like to paste some pre-defined text to a textbox of a website using chrome extension. The target website is https://www.urlgot.com/. It is a seemly simple webpage with only one input textbox. I had found a solution to get my interesting DOM content. But how to manipulate the DOM to paste my text into the "placeholder" then? As a neophyte in chrome extension scripting, I really need some advice.

有趣的DOM如下,

<div class="form-group" id="urlFormGroup">
 <input type="text" class="form-control" id="mediaWebUrl" autocomplete="off" placeholder="paste link here ..." onpaste="parse()">

我认为我应该找到一些方法用我自己的文本输入替换在此处粘贴链接..."文本.但是我不知道该怎么做. 谢谢.

I think I should find some way to replace the "paste link here ..." text with my own text input. But I don't know how to do it. Thank you.

推荐答案

您可以使用此

document.getElementById('mediaWebUrl').setAttribute('placeholder','My own text...');

这篇关于如何在&lt; div&gt;中粘贴文本镀铬扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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