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