Testing Cell Width

by ciaoben

HTML

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">

   <div class="table-responsive bis">
       
       <div id="header">
            
                <span class=" " value="0-1" >Categoria</span> 
                <span class=" " value="0-2">Descrizione</span>
                <span class=" " value="0-3">Codice</span>  
                <span class=" "  value="0-4">Stampa dati bancari</span> 
                <span class=" "  value="0-5">Stampa dati cliente</span>
                <span class=" "  value="0-6">I.V.A. prima rata</span> 
                <span class=" "  value="0-7">D.F.F.M</span> 
                <span class=" "  value="0-8"> Numero di rate</span>
                <span class=" "  value="0-9"> Giorni aggiuntivi</span>
                <span class=" "  value="0-10"> 1° rata</span>
                <span class=" "  value="0-11"> 2° rata</span>
                <span class=" "  value="0-12"> 3° rata</span>
                <span class=""  value="0-13"> Visibile</span>
                <span class=""  value="0-14"> Periodo</span>
       </div>
        
<table class=" table  table-striped" id="datatable_pagament_invisibile">
        <thead class="">
            <tr id="">  
                <th class=" ">Categoria</th> 
                <th class=" ">Descrizione</th>
                <th class=" ">Codice</th>  
                <th class=" ">Stampa dati bancari</th> 
                <th class=" ">Stampa dati cliente</th>
                <th class=" ">I.V.A. prima rata</th> 
                <th class=" ">D.F.F.M</th> 
                <th class=" "> Numero di rate</th>
                <th class=" "> Giorni aggiuntivi</th>
                <th class=" "> 1° rata</th>
                <th class=" "> 2° rata</th>
                <th class=" "> 3° rata</th>
                <th class=""> Visibile</th>
                <th class=""> Periodo</th>
            </tr>
        </thead>
        <tbody>
        <tr><td value="1-1">3</td><td...

CSS

.table-responsive {
    overflow-y:scroll; 
    height:300px; 
    display:block;  
    
    
}
#header {
    position: relative;
  
}
#header span{
    
    display:inline-block;
  

}

JavaScript

resizeCol(14);


function resizeCol(numerocolonne){
    
    var leng= $("tbody tr").length;
    for(i=1;i<=numerocolonne; i++){
        var bigger=$('[value="1-'+i+'"]').width();
        $('[value="0-'+i+'"]').width(bigger);
    }
   
    
}