I want a user to be able to a) specify a name for an input field, and then click a button to create it, whereby the name they specified becomes the name of the field. I am using jQuery. Here is what I have so far:
HTML:
<input id="paramName" type="text" class="inputForm" name="addFieldName" placeholder="Name of Parameter" />
<input id="addParameter" class="inputButton" type="button" name="addField" value="Add New Parameter" />
jQuery:
function addParams() {
var specifiedParam = $('#paramName').value;
$('<input />', {
id: specifiedParam
}).insertAfter('#formTop');
}
The inserting of the form works, but the input fields have no name. I just want to use the value of the specifiedParam variable (as defined by the user when typing in the text field) for the name of the input field.
Any help? Thanks