听到的是我的 HTML:
<div>
<input type='text' />
<input id='mybutton' type='button' value='button'/>
</div>
我想在单击按钮时查找文本框值:
最佳答案
$("#mybutton").click(function(){
var text = $('input[type=text]').val();
alert(text)
})
记住:
为输入文本添加一个ID,这样更容易在页面中找到正确的元素
关于javascript - 使用 javascript 查找文本框值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9942361/