I am trying to clone a feildset then submit the contents of inputs and selects using serialize. It is working properly however select doesn't keep its value. I have tried several methods I have found but nothing seems to work. Here is how I am cloning and setting the current data.
How can I keep the value of select when cloning?
$('body').append('<form id="form-to-submit" style="visibility:hidden;"></form>');
var fieldsetName = $this.parents('.fieldsetwrapper');
$('#form-to-submit').html($(fieldsetName).clone());
var data = $('#form-to-submit').serialize();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…