I have the following problem I'm trying to retrieve a textarea from a response div that is clicked to open, but that error when trying to retrieve the textarea for some reason I'm not getting anyone can help me?
Codes:
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>