我尝试了在这里找到的其他代码,但是没有用。
这是我的搜索框常规代码:
<script async="" src="https://cse.google.com/cse.js?cx=008573911755377469615:xhdlwjbvh7o"></script>
仅在加载窗口时设置属性。
window.onload = myCustomPlaceholder;
function myCustomPlaceholder() {
document.getElementById("gsc-i-id1").setAttribute("placeholder", "my custom search placeholder")
}