If you are already using jQuery, use it more:
$(document).ready(function() { var form = $('<form />'), dropdown = $('<select />', { name: 'SelectMenu' }), textbox = $('<input />', { type: 'text', name: 'myInputs[]' }), button = $('<button />', { text: 'Show' }).on('click', ChoixDeQuestion); for (var i = 1; i <= 3; i++) { $('<option />', { text: i }).appendTo(dropdown); } form .append(dropdown) .append('<br />Entry') .append(textbox) .append(button) .appendTo('body'); });
This creates all the nodes and inserts them into the DOM in a beautiful way; you can also just create one large string of contents
with your html and then do the following:
$(contents).appendTo('body');
Ja͢ck source share