Add new input lines to HTML entry form

Enable users to add a row of fields to an HTML input form. In this code, after the HTML loads, addForm() is called. Clicking the Add Line button calls a function, addLine(), which calls addField() once for each field in the new input line. The elements, label and input, are formatted using CSS.

Generate array of objects

Loop through HTML form lines and store the data into an array of objects

Generate a table containing data from array of objects

Local Name Local DOB Local Age Local Zodiac

Prog06 Questions

  1. JavaScript needs no import to function. All you do with JS is include the code within script tags. JQuery, however, needs a library import in the header in order for it to work.
  2. When selecting elements, jQuery is much simpler than JavaScript. JQuery only requires a $ followed by the elements name: $('element'). JS requires a longer action with document.getElementsByName('element').
  3. You need not set an element to a variable in jQuery to give it a set class. Especially trying to set CSS classes. With JS, if I wanted to change the class of an element, I would have to set it to a var, then get the element with document.getElementsByClassName(***). Then I'd have to reset the class name by looping through and changing the class name ***.className = ***.className + " whatever i wanted to add". With jQuery all I need is to say $(.***).addClass("whatever i wanted to add").
  4. JQuery can handle browser differences easier that javascript. It takes care of the differences itself rather than have the programmer worry about it.
  5. JQuery allows for super simple getting and setting. HTML elements can have their attributes changed with a simple .text(), .val() etc.