2016-05-05 9 views
1

Betrachten Sie diese Tabelle, wo ich brauche eine neue Form Pop-up, wenn LinkJQuery Mehrere Daten über href

<td><?php echo $c['diameter'] ?></td> 
<td><?php echo $c['brand'] ?></td> 
<td><?php echo $c['model'] ?></td> 
<td><?php echo $c['load_index'] ?></td> 
<td><?php echo $c['qty'] ?></td> 
<td><?php echo $c['vendor'] ?></td> 
<td> <?php echo $c['tire_id'] ?></td> 
<td><a href="#" data-toggle="modal" data-target="#myModal" class="changebtn" data-tireid="<?php echo $c['tire_id'] ?>" >Accept?</a></td> 


<script> 
    $(".changebtn").click(function(){ 
    $("#readonlytire_id").val($(this).attr("data-tireid")); 
    }); 
</script> 

Jetzt habe ich eine Art versteckte Eingang klicken, dass JQuery automatisch einen Wert

<input id="readonlytire_id" type="hidden" name="tire_id"> 
bevöl

Aber ich brauche, dies zu ändern, stattdessen muss ich 6 Eingang unter readonly_id wie Etwas

hinzufügen
<input id="readonlytire_id" type="hidden" name="tire_id"> 
    <input id="brand" type="hidden" name="brand"> 
    <input id="model" type="hidden" name="model"> 
    <input id="qty" type="hidden" name="qty"> 

Haben Sie eine Idee?

Antwort

0
<td id='diameter'><?php echo $c['diameter'] ?></td> 
<td id='brand'><?php echo $c['brand'] ?></td> 
<td id='model'><?php echo $c['model'] ?></td> 
<td id='load_index'><?php echo $c['load_index'] ?></td> 
<td id='qty'><?php echo $c['qty'] ?></td> 
<td id='vendor'><?php echo $c['vendor'] ?></td> 
<td id='tire_id'><?php echo $c['tire_id'] ?></td> 

<td><a href="#" data-toggle="modal" data-target="#myModal" 
class="changebtn" data-tireid="<?php echo $c['tire_id'] ?>" >Accept? 
</a></td> 

<script> 
    $(".changebtn").click(function(){ 
     $("#readonlytire_id").val($(this).attr("data-tireid")); 
     // get the html value and feed the hidden fields with it 
     $('#readonly_brand').val($('#brand').html()); 
     ... // same for all additonal fields 
    }); 
</script>