remove external elements usage,
use container instead of $
move form generation to one <script> element at the end of document,
delay generation while document is ready:  $(function() { ...
rant
add next button to template generation
use next button and simplify the code
make next button be disabled by default
merge all scripts in one <script> block
simplify
reformat code
do not use block style in generated HTML
simplify code, fix layout