How to use jQuery to add form elements dynamically

前端 未结 3 1744
后悔当初
后悔当初 2020-11-28 09:17

Here is my html:

3条回答
  •  悲&欢浪女
    2020-11-28 10:08

    both Pevara and PSL scripts not working correctly all new lines names/ids are same as first one so there is no way to get the values later from them in the script .substring(index+9,1) should be corrected to .substring(index+9,index+10) but even than next will be always ==2 as $person.html(); haven't been really changed

    here are 3 solution options : https://www.jqueryscript.net/form/jQuery-Plugin-To-Dynamically-Add-More-Form-Fields-czMore.html

    https://www.codexworld.com/add-remove-input-fields-dynamically-using-jquery/

    https://www.sanwebe.com/2013/03/addremove-input-fields-dynamically-with-jquery

提交回复
热议问题