$selectMenus = $("#experiences").find('select');
$tab.find('input').each(function(i) {
var $elem = $(this);
var value = $elem.attr('value');
if(!value)
value = ' ';
$parent = $elem.parent();
$elem.remove();
$parent.html(value);
});
$tab.find('select').each(function(i) {
$('option', this)[$selectMenus[i].selectedIndex].selected = true;
var $elem = $(this);
var value = $elem.attr('value');
if(!value)
value = ' ';
$parent = $elem.parent();
$elem.remove();
$parent.html(value);
});
Note the two are almost the same.