Hi,

I had an issue with the clone() function in that it wasn't copying
over select values. I've added this function to my page

function cloneForm(id, withEvents)
{
  var clone = $('#'+id).clone(withEvents);
  var selvals = [];
  $('#'+id+" select").each(function()
  {
    selvals.push($(this).val());
  });
  clone.find("select").each(function()
  {
    $(this).val(selvals.shift());
  });
  return clone;
}

which will clone the values as well. I'm a relative Jquery newbie so I
imagine there is a better way of doing this, maybe over-riding/loading
the clone function or putting it in the jquery source but I've a bit
of a way to go till I'm confident of digging that deep. Hopefully this
will be of some use to someone.

Cheers

Mark

Reply via email to