[英]Print Element names in Console Use Firebug
I want to listing all input elements in console of firebug so in console window write the followings: 我想列出firebug控制台中的所有输入元素,所以在控制台窗口中写下如下:
var inputs = $(":input");
console.log(inputs);
but when I press the Run in console appear null
但是当我按下Run in console时显示为
null
also when I write just var inputs = $(":input");
当我写的只是
var inputs = $(":input");
the console show Undefined
I sure the page have a lot of input elements, where is the problem? 控制台显示
Undefined
我确定页面有很多输入元素,问题出在哪里?
There is nothing wrong with the provided snippet. 提供的代码段没有任何问题。
Though, without specifying what to write (using console.log
) firebug will print whatever the last statement returned, when declaring a variable using var
the result is always undefined
. 虽然,没有指定要写的内容(使用
console.log
),firebug将打印返回的最后一个语句,当使用var
声明变量时,结果始终是undefined
。
var inputs = $(":input"); // firebug printing 'undefined' is valid
var abc = 123; // results in the same thing
Please make sure that the website in question actually uses jQuery
(bound to global $
), and that there really are input elements present in the DOM. 请确保有问题的网站实际上使用
jQuery
(绑定到全局$
),并且DOM中确实存在输入元素。
Also make sure that the jQuery version running is of a version later/equal to 1.0 ( :input
selector didn't exists until then). 还要确保运行的jQuery版本的版本稍后/等于1.0(
:input
选择器在此之前不存在)。
If it has jQuery it probably is of a more recent version, how ever; 如果它有jQuery它可能是一个更新的版本,如何; without you providing us with additional information there is no way to guarantee it.
如果您没有向我们提供其他信息,则无法保证。
simply go to the firebug console and wrtie as @refp mentioned the page in question must have jquery included 只需转到firebug控制台和wrtie,因为@refp提到有问题的页面必须包含jquery
$(":input")
press run 按下运行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.