Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JQuery按钮数据返回为空?_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript JQuery按钮数据返回为空?

Javascript JQuery按钮数据返回为空?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个按钮,当我单击它时,我希望html对象(aka button)作为参数传递给另一个javascript函数。我希望javascript函数从按钮中的元素打印数据hi HTML按钮 为什么测试返回null?不应该var btn=$(“thisButton”)bevar btn=$(此按钮)(不带引号)只是一个打字错误 $("thisButton") !== $(thisButton); 删除引号,这样您就不会查找带有标记名的元素thisButton var btn = $("thisBu

我有一个按钮,当我单击它时,我希望html对象(aka button)作为参数传递给另一个javascript函数。我希望javascript函数从按钮中的元素打印数据hi

HTML按钮
为什么测试返回null?

不应该
var btn=$(“thisButton”)be
var btn=$(此按钮)(不带引号)

只是一个打字错误

$("thisButton") !== $(thisButton);
删除引号,这样您就不会查找带有标记名的元素
thisButton

var btn = $("thisButton");
需要

var btn = $(thisButton);

我现在意识到了。谢谢
var btn = $("thisButton");
var btn = $(thisButton);