alguna ayuda??
jquery clone:
(function($) {
$.fn.relCopy = function(options) {
var settings = jQuery.extend({
excludeSelector: ".exclude",
emptySelector: ".empty",
copyClass: "copy",
append: '',
clearInputs: false,
limit: 0 // 0 = unlimited
}, options);
settings.limit = parseInt(settings.limit);
// loop each element
this.each(function() {
// set click action
$(this).click(function(){
var rel = $(this).attr('rel'); // rel in jquery selector format
var counter = $(rel).length;
// stop limit
if (settings.limit != 0 && counter >= settings.limit){
return false;
};
var master = $(rel+":first");
var parent = $(master).parent();
var clone = $(master).clone(true).addClass(settings.copyClass+counter).append(settings.append);
//Remove Elements with excludeSelector
if (settings.excludeSelector){
$(clone).find(settings.excludeSelector).remove();
};
//Empty Elements with emptySelector
if (settings.emptySelector){
$(clone).find(settings.emptySelector).empty();
};
// Increment Clone IDs
if ( $(clone).attr('id') ){
var newid = $(clone).attr('id') + (counter +1);
$(clone).attr('id', newid);
};
// Increment Clone Children IDs
$(clone).find('[id]').each(function(){
var newid = $(this).attr('id') + (counter +1);
$(this).attr('id', newid);
});
//Clear Inputs/Textarea
if (settings.clearInputs){
$(clone).find(':input').each(function(){
var type = $(this).attr('type');
switch(type)
{
case "button":
break;
case "reset":
break;
case "submit":
break;
case "checkbox":
$(this).attr('checked', '');
break;
default:
$(this).val("");
}
});
};
$(parent).find(rel+':last').after(clone);
return false;
}); // end click action
}); //end each loop
return this; // return to jQuery
};
})(jQuery);
archivo.php
<form name="dummy" id="dummy" method="post" action="clonesubmit.php">
<table width="337" border="1" >
<tr>
<td width="60" style="text-align:center">Codigo solicitud</td>
<td width="58" style="text-align:center">Codigo producto</td>
<td width="145" style="text-align:center">Producto</td>
<td width="46" style="text-align:center">Cantidad</td>
</tr>
</table>
<div id="input" class="clone">
<input type="text" name="id_solicitud[]" id="id_solicitud" readonly="readonly" value="<?php echo $now_id; ?>" class="input" style="width:60px" />
<input type="text" name="id_producto[]" id="id_producto" style="width:60px" value="" readonly="readonly" class="input" />
<select name="producto[]" id="producto" style="width:150px" class="input" onchange="document.forms['dummy'].elements['id_producto'].value = document.forms['dummy'].elements['producto'].value;" >
<option> -select- </option>
<?php while($res=mysql_fetch_array($firstQry)){?>
<option value="<?php echo $res["id_producto"]?>"><?php echo $res["descripcion"]?></option>
<?php }unset($firstQry,$res);?>
</select>
<input type="number" name="cantidad[]" id="textfield2" style="width:50px" autocomplete="off" />
</div>
<p>
<div><a href="#" class="add" rel=".clone">Agregar Otro</a></div>
<p>
<table width="51" >
<tr>
<td width="41"><input type="submit" value="Enviar" /></td>
</tr>
</table>
</form>