<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){ - this is saying to wait until document is ready before calling function
$("button").click(function(){ - this is saying when "button" is click to perform function.
alert("Value: " + $("#test").val()); - this is saying to show value in pop up box.
});
});
</script>
</head>
<body>
<p>Name: <input type="text" id="test" value="Mickey Mouse"></p> - this is input for the value
<button>Show Value</button> - this is the button.
</body>
</html>
我想知道如何让值显示在 html 正文而不是弹出框中。我在想我可以使用 $(selector).document.write 函数,但它似乎不起作用。任何援助将不胜感激。先感谢您。