出于某种原因,我无法使用 id
在字段中显示此结果。使用class
它工作得很好,但它只是拒绝使用id
。
JSFiddle在这里http://jsfiddle.net/pbe4b/15/
工作正常:
<input id="button123" placeholder="number here"></input>
<span class="output123"></span>
不起作用:
<input id="button123" placeholder="number here"></input>
<input id="output123"></input>
希望得到任何帮助!
最佳答案
使用
$('#output123').val()
而不是
$('#output123').html()
input
是自闭合标记,因此您应该使用 val()
从中获取值。
关于javascript - jQuery 结果未显示在字段中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21883476/