how to create dynamic row with input fields in html table from given row

前端 未结 3 1484
醉话见心
醉话见心 2021-01-17 06:53

Im new for Html and javascript. I want to create dynamic row with input fields in table while click button,that number of row given from user. In my code, row created dynami

3条回答
  •  借酒劲吻你
    2021-01-17 07:19

    What you did was setting new value to the table each time. what you actually would like to do is appending data to the table using "appendChild" function. this can also be created, even more easily, using

    here is a working fiddle with the change (using js appendChild):

    
    
    
        
        
        
    
        
    
    
    
    
    

    i would recommend learning to use jquery. anyway, here is some info about the functions i mentioned: jquery and their "append" function.

    info about js appendChild - http://www.w3schools.com/jsref/met_node_appendchild.asp jquery append - http://api.jquery.com/append/

提交回复
热议问题