I have the following script that dynamically builds text fields with a value from other input element.
The value is displayed on the screen but it doesn't get inserted into value="" as inspected in the dev tool. I need the value to be inserted as value="" so that the form data can be persisted.
$(document).on('click', 'button', function(event) {
$("fieldset").append($('<input>').prop('type', 'text').val($('#entry').val()));
});

$('<input>').attr('value', $('#entry').val())attr. If you make this as an answer, I can settle this question.