jQuery实时监听input 输入的值 并赋给另一个input文章源自知更鸟-https://zmingcx.com/jquery-monitors-input.html
HTML文章源自知更鸟-https://zmingcx.com/jquery-monitors-input.html
<input class="box1" type="text" placeholder="请输入值"> <br> <input class="box2" type="text" placeholder="请输入值">
CSS文章源自知更鸟-https://zmingcx.com/jquery-monitors-input.html
input { margin:1rem }
jQuery文章源自知更鸟-https://zmingcx.com/jquery-monitors-input.html
$(function() { $(".box1").bind('input propertychange', function() { var a = $(".box1").val(); $(".box2").val(a); }) $(".box2").bind('input propertychange', function() { var b = $(".box2").val(); $(".box1").val(b); }) })文章源自知更鸟-https://zmingcx.com/jquery-monitors-input.html

版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论