如何通过单击Jquery链接添加输入?

时间:2023-01-20 19:46:15

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.

我有4个输入,其中3个是隐藏的。我想要的是每当用户将“添加更多图片”。它会显示隐藏的输入,只需点击时间链接即可。我不知道它在Jquery中是如何工作的?如果有人帮助我会感激。

<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>

1 个解决方案

#1


1  

try this:

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

DEMO

#1


1  

try this:

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

DEMO