答案 0 :(得分:0)
WP联络表7:
添加一些文件上传字段:
<p class="hide">[file file-01]</p>
<p class="hide">[file file-02]<a class="del_file" href="#">Delete</a></p>
<p class="hide">[file file-03]<a class="del_file" href="#">Delete</a></p>
<a href="#" class="add_file">Add file </a>
接下来,添加此脚本(您需要JQuery)
jQuery(document).ready(function($){
//hide all inputs except the first one
$('p.hide').not(':eq(0)').hide();
//functionality for add-file link
$('a.add_file').on('click', function(e){
//show by click the first one from hidden inputs
$('p.hide:not(:visible):first').show('slow');
e.preventDefault();
});
//functionality for del-file link
$('a.del_file').on('click', function(e){
//var init
var input_parent = $(this).parent();
var input_wrap = input_parent.find('span');
//reset field value
input_wrap.html(input_wrap.html());
//hide by click
input_parent.hide('slow');
e.preventDefault();
});
});
现在你可以隐藏和显示你的字段了!