How to clone two columns in a table using jQuery

后端 未结 5 1589
执笔经年
执笔经年 2021-01-18 15:44

I am trying to clone 2 columns from a table to a new table using jQuery. The source table is below:



        
      
      
      
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 16:21

    I have goog way, how to play with columns, i write here full code:

    function add_column(copy, paste)
    {
    		$("."+copy+":first").clone().appendTo("."+paste);
    		$("."+paste+" tr:last input").val('');
    		$("."+paste+" tr:last select").val('');
    		// and etc...
    }
    
    function remove_column(e, paste)
    {
    		var how = $("."+paste+" tr").length;
    		if(how >= 2)
    		{
    				$(e).parent().parent().remove();
    		} else {
    				$("."+paste+" input").val('');
    				$("."+paste+" select").val('');
    				// and etc...
    		}
    }
Priežastis Data nuo Data iki Pastabos Veiksmai
 

提交回复
热议问题