html点击按钮动态添加input文本框


html
<div id="org"></div> //注意:id不能写在button上,js获取不到button的id(可能是我们公司的框架的原因)
<input type="button" onclick="add1();" value="添加" />
script <script type="text/javascript"> function add1(){ var input1 = document.createElement('input'); input1.setAttribute('type', 'text'); input1.setAttribute('name', 'organizers[]'); input1.setAttribute('class', 'git'); var btn1 = document.getElementById("org"); btn1.insertBefore(input1,null); } </script>

 

Summer PHP框架


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM