Removed the html that added the inputfields from the mainsection div and added it dynamically from the javascript instead.