I am using the script below to generate input fields as needed. However, upon refresh or when clicking back on the submission error page, the fields and information entered disappear. Is there any way to retain the fields after clicking back or refreshing the page?
$(document).ready(function() {
var MaxInputs = 67;
var InputsWrapper = $("#InputsWrapper");
var AddButton = $("#AddMoreFileBox");
var x = InputsWrapper.length;
var FieldCount=8;
$(AddButton).click(function (event)
{
if(x <= MaxInputs)
{
FieldCount++;
$(InputsWrapper).append('<div><input type="text" class="input" size="22"
maxlength="80" name="hostname'+ FieldCount +'" id="field_'+ FieldCount +'"/>
<input class="left-margin" type="text" SIZE="15" MAXLENGTH="15" name="ipaddr'+
FieldCount +'" id="field_'+ FieldCount +'"/><input class="left-margin"
type="text" SIZE="15" MAXLENGTH="15" name="app'+ FieldCount +'" id="field_'+
FieldCount +'"/> <button type="button"class="removeclass">Remove</button>
</div>');
x++;
}
return false;
});
$("body").on("click",".removeclass", function(event){
if( x > 1 ) {
$(this).parent('div').remove();
x--;
}
return false;
})
});