Javascript 简单jquery无法打印输入值
下面是一个简单的代码,它接受输入并在同一页上打印。但当我点击按钮时,它不工作。请帮忙Javascript 简单jquery无法打印输入值,javascript,jquery,html,browser,Javascript,Jquery,Html,Browser,下面是一个简单的代码,它接受输入并在同一页上打印。但当我点击按钮时,它不工作。请帮忙 <html> <head> <script> function changeHTML() { $("#withjQuery").html($("#theInput").val()); } </script> <body> <input type='text' id='theInput' value='Write here' />
<html>
<head>
<script>
function changeHTML() {
$("#withjQuery").html($("#theInput").val());
}
</script>
<body>
<input type='text' id='theInput' value='Write here' />
<input type='button' onClick='changeHTML();' value='See what you wrote with jQuery.html'/>
<div id="withjQuery"></div>
</body>
</head>
函数changeHTML(){
$(“#withjQuery”).html($(“#输入”).val());
}
页面中没有jQuery库
加
前
函数changeHTML(){
$(“#withjQuery”).html($(“#输入”).val());
}
演示:+1。事实上,我评论说它对我有用,然后才意识到图书馆不见了:)@Harry也对我有用。。。我先试过小提琴。。。才意识到哦。!!好的,谢谢……)\在你的头脑中加入这个
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
function changeHTML() {
$("#withjQuery").html($("#theInput").val());
}
</script>
</head>
<body>
<input type='text' id='theInput' value='Write here' />
<input type='button' onClick='changeHTML();' value='See what you wrote with jQuery.html'/>
<div id="withjQuery"></div>
</body>
</html>