我正在尝试制作一个chrome扩展,当我的推特用户出现在我的订阅源上时,它会更改他们的名称。当我尝试在谷歌铬控制台做:
$("#fullname-js action profile name show popup with id").html("你好!");
结果只是一个空数组"[]"。
当我输入时:
document.getElementById("#fullname-js动作配置文件名称显示带id的弹出窗口").html("你好!");
我得到错误:"无法设置null的"html"属性"。
有人知道我做错了什么吗?
您可能想要使用这样的东西:
var twitterNames = $(".fullname.js-action-profile-name.show-popup-with-id");
或者类似的东西:
var twitterNames = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id");
一旦获得了页面上所有元素的数组,就可以索引到该数组中进行更改。