2017-04-27 46 views

回答

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

現在你可以隱藏並顯示你的領域!

相關問題