JQuery add input
I have <input type="file" name="p1" size="100" />
tell me how to add <input type="file" name="p2" size="100" />etc. using jquery add ..
thank
I'm trying var i = $ ('input'). size () + 1;
$('a.add').click(function() {
$('<input type="file" name"p' + i + 'size="100" />')
.animate({ opacity: "show" }, "slow")
.appendTo('#inputs');
i++;
});
Your HTML is corrupted:
$('<input type="file" name"p' + i + 'size="100" />')
it should be
$('<input type="file" name="p' + i + '" size="100" >')
The original was missing the "=" symbol and the double quote character for the value of the name attribute. Also you do not need to close tags <input>.