pegarValor hidden em loop
Eai galera estou com um problema como eu consigo pegar o valor de um hidden dento de um loop ?
Estou tentando assim
<div id="ultimosPost"> <table border="0" width="680" cellpadding="0" cellspacing="0" class="list"> <thead> <tr> <th>NICK</th> <th>COMPRA DE </th> <th>CODIGO DE TRANSAÇÃO </th> <th>PROBLEMA OCORRIDO </th> <th>Visualizar</th> <th>Marcar com resolvido</th> </tr> </thead> <tbody> <?php //loop$query = mysql_query("SELECT * FROM posts", $con);while($loop = mysql_fetch_object($query)){?> <tr> <td align="center"><?php echo $loop->nick;?></td> <td align="center"><?php echo $loop->tipo;?></td> <td align="center"><?php echo $loop->codigo;?></td> <td align="center"> <input type="submit" name="Mostrar" id="Mostrar" class="mostrar" value="Mostrar"></td> <td align="center"><a href="?pagina=editarPostagem&post=<?php echo $lastPost->id;?>">Editar</a></td> <td align="center"><a href="?excluir=sim&post=<?php echo $lastPost->id;?>"><img src="img/btn_del.png" border="0" /></a></td><input name="idMSG" type="hidden" id="idMSG" value="<?php echo $loop->id;?>" class="idMSG" /> </tr> <?php } ?> </tbody> </table> </div><!-- Fecha ultimosPost --->
$(document).ready(function(){ $(".mostrar").click(function(){ var $this = $( this ); var $idMSG = $this.parents('#ultimosPost').find('.idMSG').val(); alert($idMSG); }); });
up ,0.
Discussão (3)
Carregando comentários...