Take the value out of an input id

0

I am passing data from a table to a modal to edit it, all this happened:

So I send it to the modal:

<td class="otrotdfgaz" id="Producto<?php echo $res['pedID']; ?>"><?php echo $res['producto']; ?> <?php echo $res['alias']; ?></td>

This is how I get them in the modal

<script>
        $(document).ready(function(){
            $(document).on('click', '.pedido', function(){
                var id=$(this).val();
                var Idp=$('#Idp'+id).text();
                var Estado=$('#select2-1'+id).children('span').first().text();
                var Numero=$('#Numero'+id).text();
                var Fecha=$('#Fecha'+id).text();
                var Vencimiento=$('#Vencimiento'+id).text();
                var Producto=$('#Producto'+id).text();
                var Total=$('#Total'+id).text();
                var Tipo=$('#select2-4'+id).children('span').first().text();
                var Ref=$('#select2-3'+id).children('span').first().text();

                $('#pedido').modal('show');
                $('#eIdp').val(Idp);
                $('#eNumero').val(Numero);
                $('#eFecha').val(Fecha);
                $('#eVencimiento').val(Vencimiento);
                $('#eProducto').val(Producto);
                $('#eTotal').val(Total);


                //alert(Estado);
                if(Estado == 'Pagado')
                  $('select#select2-1').val('1').trigger('change');
                else
                  $('select#select2-1').val('0').trigger('change');

                if(Tipo == 'Alquiler')
                  $('select#select2-4').val('1').trigger('change');
                if(Tipo == 'Comprada')
                  $('select#select2-4').val('2').trigger('change');
                if(Tipo == 'Exp.Compartida')
                  $('select#select2-4').val('3').trigger('change');
                if(Tipo == 'Alq. Opción a compra')
                  $('select#select2-4').val('5').trigger('change');


                if(Ref == 'Sin asignar')
                  $('select#select2-3').val('0').trigger('change');
                else
                  $('select#select2-3').val('').trigger('change');

                 });
             });
    </script>

This is how I print them in the modal input

<div class="form-group">
   <label>Producto</label>
   <input type="text" class="form-control inputmiocont corpiii" id="eProducto" name="eProducto">
</div>

What I want to know if there is a possibility of the same thing that is printed in the input through the id, is there the option of printing it in a variable, for example something like this?

$Producto = "no se como poner lo de eProducto";

Thanks !!!

    
asked by Miguel 29.08.2018 в 11:18
source

0 answers