I am trying to insert a element in a form with jQuery.
To do this, I clone the element, change the attribute and insert, then use .html() to convert the jquery object to HTML object but it doesn't work.
function addInput(divName){
var selector= $('#tipoProducto').clone();
selector.attr('name', counter );
var newdiv = document.createElement('div');
newdiv.innerHTML = "<li>porcentaje "
+ (counter + 1)
+ "</li><li>\
<input type='text' name='myInputs[]'></li>\
<li>Ingediente Activo"
+ (counter + 1)
+ "</li><li>"
+ selector.html()
+ "</li>";
document.getElementById(divName).appendChild(newdiv);
counter++;
}