【发布时间】:2017-04-08 08:51:09
【问题描述】:
在 google.com 输入上执行检查元素时,我得到:
<input class="gsfi" id="lst-ib" maxlength="2048" name="q" autocomplete="off" title="Search" type="text" value="" aria-label="Search" aria-haspopup="true" role="combobox" aria-autocomplete="both" dir="ltr" spellcheck="false" style="border: none; padding: 0px; margin: 0px; height: auto; width: 100%; background: url("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D") transparent; position: absolute; z-index: 6; left: 0px; outline: none;">
现在如果我这样做:$("#lst-ib"),我会按预期获得输入对象。但是如果我这样做:$("#lst-ib").val("hello world!"),我会得到一个错误:
Uncaught TypeError: $(...).val is not a function(…)
Bing.com 也发生了同样的事情。有人可以解释为什么会发生这种情况以及如何使用Javascript 或Jquery 在这些网站上进行搜索。
【问题讨论】:
-
$ 并不意味着是 jquery。它可以只是他们内部程序员编写的某些选择器函数的命名空间。
标签: javascript jquery