Getting value from a row of a column in the table with js

0

I have an editable table, where I only change the amount, I already get the value of the first column and the last one. I need to get the value of docEntry with the java script but as I understand little of js I can not, someone can give me this help? Thanks

<table id="tblEditavel" data-height="299"  data-show-columns="true"  class="table table-striped table-condensed">
        <thead>
            <tr>
               <th>N</th>
               <th>Numero do pedido</th>
               <th>Descrição</th>
               <th>Cod do item</th>
               <th >Quantidade</th>                                          
            </tr>
       </thead>
               <tbody> 
                @for($i=0 ;$i < count($produtos);$i++)
                <tr>
                <td>{{$i }}</td>
                <td title="DocEntry">{{ $produtos[$i]->DocEntry }}</td>
                <td title="Dscription">{{ $produtos[$i]->Dscription}}</td>
                <td title="ItemCode" >{{ $produtos[$i]->ItemCode}}</td>
                <td title="quantidade" class="editavel">{{ $produtos[$i]->U_QTDCONF}}</td>               
            </tr>
                @endfor
          </tbody>

$(document).ready(function(){   
$('#tblEditavel tbody tr td.editavel').dblclick(function(){
     if ( $('td > input').length > 0){
    return;
}
    var conteudoOrigininal = $(this).text();       
    var novoElemento = $('<input/>', {type:'text', value:conteudoOrigininal});
    $(this).html(novoElemento.bind('blur keydown', function(e){
        var keyCode = e.which;                      
        if( keyCode == 9 ){  
            var conteudoNovo = $(this).val();
            var numero = $(this).parents('tr').children().first().text();                
            var campo = $(this).parent().attr('title');
            if( conteudoNovo != "" ){              
            $(this).parent().html(conteudoNovo);      
            }
            $.ajax({
                type:"POST",
                url:'../produto/cadastrar-quantidade',                   
                data:{
                    id:numero,
                    campo:campo,                        
                    valor:conteudoNovo,
                    _token: $('input[name="_token"]').val()
                },
                success:function(result){
                        $(this).parent().html(conteudoNovo);
                        $('body').append(result);
                    }
            })
       }
       if(e.type == "blur") {
         $(this).parent().html(conteudoOrigininal);
       }            
    }));
    $(this).children().select();
})

})

    
asked by anonymous 22.09.2015 / 16:43

0 answers