不能得到这个基础。点击事件工作 这里是我的代码:jQuery的。点击价值变动
$("#thebutton").click(function(){
var text = $("input1").val();
$("#input2").val(text);
});
这里是codepen http://cdpn.io/GFoxs
不能得到这个基础。点击事件工作 这里是我的代码:jQuery的。点击价值变动
$("#thebutton").click(function(){
var text = $("input1").val();
$("#input2").val(text);
});
这里是codepen http://cdpn.io/GFoxs
你错过了#
签收id selector,你还需要包括jQuery的正确的你得到错误“未捕获的ReferenceError:$没有定义”,这article可以帮助你了解
变化
var text = $("input1").val();
要
var text = $("#input1").val();
在这里,您正在使用的ID,这样使用#
$("#thebutton").click(function(){
var text = $("#input1").val(); //$("input1").val(); change this
$("#input2").val(text);
});
尝试这样
$("#thebutton").click(function(){
var text = $("#input1").val();
$("#input2").val(text);
});
看到错误:
Uncaught ReferenceError: $ is not defined
您还没有包括jQuery库...
然后:
var text = $("#input1").val() //<--Missing id selector here
Fastastic,欢呼家伙,学校的男孩错误:( – 2013-03-21 12:49:00