0
I’m having the following problem I’m trying to recover a textarea from a div answer that is clicked to open, but that from the error while trying to recover the textarea for some reason I’m not getting anyone to help me ?
code:
javascript
function addEventosRespostas() {
$('.resposta')
.on("click", function(){
var id = $(this).children('input').val();
var texto = $('.resp').children('#texto').val();
$(this).fadeOut("fast");
$('.coment').find('.resp').fadeOut("slow",function(){
$('.resposta').fadeIn("fast");
});
$(this).parents('.coment').find('.resp').fadeIn("slow");
$('.resp').find('input').on("click",function(){
alert(texto);
// $.post('swith/viwer.php',{
// acao: 'responder', id: id},
// function(){
// $('.visualizaron').fadeOut('slow');
// });
return false;
});
return false;
});
}
html with php
<div class='comentar fl-left'>
<div class='coment com' >
<?php
if($foto == "" || $foto == "uploads/"):
echo "<a href='user?id={$id}'><img class='fl-left' src='".REQUIRE_PATH."/css/boot/icons/thumb.png'></a>";
else:
echo "<a href='user?id={$id}'><img class='fl-left' src='{$imx['foto']}'></a>";
endif;
?>
<p><small class='fontze1'>Comentado por:</small> <?=$nome?> <small>Em: </small> <?=$date?> <small>As: </small> <?=$hora?></p>
<div class="comentando">
<p><?=nl2br($comentario)?></p></div>
<div class='fl-right resposta'>Responder<input type='hidden' value='<?=$big[id] ?>' name='idcoment'>
</div>
<div class=' resp' style='display:none'>
<form method='post' name="comentarios">
<textarea id="texto"></textarea>
<input class='btn btn-green' type='submit' value='responder' name='responder'>
</form>
</div>
</div>
now had an error when I open an answer instead of it display the one I chose it opens the last shown not showing which one I typed
– Guilherme Sousa
I edited the answer, use the
siblings
to pick up elements on the same level.– Inkeliz
managed to solve the problem I instated the form and got better I did otherwise helped me a lot your tips thank you
– Guilherme Sousa