Chrome 修改 Twitter 的 innerHTML 的扩展
Chrome Extension to modify innerHTML of Twitter
我正在尝试制作一个 chrome 扩展程序来更改我的 Twitter 用户在我的 Feed 上显示的名称。当我尝试在 google chrome 控制台中执行以下操作时:
$("#fullname js-action-profile-name show-popup-with-id").html("Hello!");
结果只是一个空数组“[]”。
还有当我输入时:
document.getElementById("#fullname js-action-profile-name show-popup-with-id").html("Hello!");
我收到错误:"Cannot set property of "html" of null".
有人知道我做错了什么吗?
你会想使用这样的东西:
var twitterNames = $(".fullname.js-action-profile-name.show-popup-with-id");
或者像这样:
var twitterNames = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id");
获得页面上所有元素的数组后,您可以索引数组以更改它们。
我正在尝试制作一个 chrome 扩展程序来更改我的 Twitter 用户在我的 Feed 上显示的名称。当我尝试在 google chrome 控制台中执行以下操作时:
$("#fullname js-action-profile-name show-popup-with-id").html("Hello!");
结果只是一个空数组“[]”。
还有当我输入时:
document.getElementById("#fullname js-action-profile-name show-popup-with-id").html("Hello!");
我收到错误:"Cannot set property of "html" of null".
有人知道我做错了什么吗?
你会想使用这样的东西:
var twitterNames = $(".fullname.js-action-profile-name.show-popup-with-id");
或者像这样:
var twitterNames = document.getElementsByClassName("fullname js-action-profile-name show-popup-with-id");
获得页面上所有元素的数组后,您可以索引数组以更改它们。