# React网站用脚本填写文本框不生效

{% embed url="<https://v.douyin.com/r8PasvU/>" %}

之前

分享了在书签栏里写脚本的方法以后

有的小伙伴在实践的过程发现

碰到这种React写的网站

他里边这种文本框就没法赋值

比如说这样哈

看上去赋上了但鼠标一点呢他就没了

那其实这个方法之前我在群里发过

但最近还是有人问

所以我们今天再说一遍

这次我把代码放到这了

大家自己来复制就好了在这

然后另外还有两个

一个是复制CSDN代码的

这个之前也分享过

然后还有一个

就是CSDN文章展开的这个

一会给大家看下效果

我们先说React的这个啊

这个代码我已经复制好了

我直接在这粘贴大家看啊

这个先删掉

其实就是一个

方法大家看

这个提供的就是一个方法

然后你想给什么文本框赋值呢

你就掉这个方法就好了

大家看比如说我想给这个框赋值

我检查一下元素

在这复制一下他的 selector

copy selector

然后呢在这把这 selector 拿过来

然后想赋什么值

比如说 xiaoshan.bug

大家看 这样就赋上了

鼠标点击也没问题了

再把这行代码放到这个书签栏里

好我们再来试一下哈

刷新一下

设置，大家看 就没有问题了

没有问题了

然后呢

再给大家演示一下

这个文章展开的效果哈

就是有的文章他只展示了一部分

剩下的呢你需要关注才能看

所以呢

你可以把这个脚本放到这里边

然后一点，大家看就展开了

这样就能看了


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sunzsh.gitbook.io/xiaoshan.bug/react-wang-zhan-yong-jiao-ben-tian-xie-wen-ben-kuang-bu-sheng-xiao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
