在Contact 7或Gravity表单中添加更多文件选项

时间:2017-04-27 09:16:56

标签: wordpress plugins

我需要按照设计上传多个文件。 这是截图。 enter image description here 但我在联系人7和重力形式上搜索它。但没找到。有人有什么想法吗?

由于

1 个答案:

答案 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();
    });
  });

现在你可以隐藏和显示你的字段了!