$(document).ready(function() { //为按钮绑定单击事件 $("input[type='button']").click(function() { var inputValue = $("#testInput").val(); alert(inputValue); }) })
<body> <input type="text" id="testInput" name="test" value="" /> <input type="button" value="输入的值为" /> </body>