Skip to content
Advertisement

Create Form dropdown list with input amount value

I ask for help or suggestions for the form I made: Template Design:

enter image description here

I want to create a form where the item list can select the available items in the drop down and then give it the amount used. then there is an add button to add another item. i am confused how to make html form and javascript / ajax for this design

Advertisement

Answer

You can replicate the components and remove components by using JavaScript’s onclick event and Nodes.

JavaScript
JavaScript

When you click the “Add more” button, it will trigger the moreFields(). Inside that function, it keeps a count of the rows that currently created by using the counter variable. Then it creates a copy of the elements inside the element ID: readroot and append it to the element Section with ID: writeroot.

When you click the button with “x” value, it will trigger a removeChild() function and removes the row connected to the “x” button.

References: Click Here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement