Isaac Isaac - 13 days ago 6
Javascript Question

What is the technology to auto add a web form element?

I am trying to learn web development, particularly on the aspect of dynamically adding form elements on the fly when a button is clicked.

For instance, I want to create a form with one text input box initially shown. There will be a '+' button, which when clicked will make another input box appear.

Can someone tell me what keywords should I google for to learn more about the best technology to achieve such?

Answer

JavaScript is what is used for this. There are many, many, many JavaScript plugins and extensions that make it easier. JQuery, AngularJS, ReactJS; just to name a few.

For instance, with jQuery, you simply do...

$document.ready(function(){
     $('#add').on('click', function(){
         $('#form').append('<input type="text">');
      )}
 })

 <div id='form'>
     <button id='add' value='Add Text Box' />
 </div>
Comments