Fixed js to create new fields dynamically