user1494854
user1494854

Reputation: 171

How to add inputs by clicking link through Jquery?

I have 4 inputs 3 of them are hidden. What I want is whenever user will the "Add More Pics". It will show the hidden inputs as many as time link is clicked. I dont have idea how it will work in Jquery? If someone helps I would be thankful.

<html>
<head>
</head>
<body>
<form>
<input type="file" id="pic1" />
<input type="file" style="display:none;" id="pic2" />
<input type="file" style="display:none;" id="pic3" />
<input type="file" style="display:none;" id="pic4" />

<a href="#" id="AddMore">Add More Links</a>
</form>
</body>
</html>

Upvotes: 2

Views: 111

Answers (1)

Ram
Ram

Reputation: 144669

try this:

$('#AddMore').click(function(e){
   e.preventDefault();
   $('input[type="file"]:hidden:first').show()
})

DEMO

Upvotes: 1

Related Questions