Get the val() of textarea within a foreach of php with a button in jquery -
get val() of textarea within foreach of php button in jquery
$(document).ready(function(){ $('.boton_responder').click(function(){ var cod = $(this).attr("name"); var texto = $('input[name="'+cod+'"]' ).val(); console.log(texto); }); });
it's system of comment in html php , jquery, when admin logged in system, show comments without answers , show field textarea admin write answers.
so, i'm stop here because in console.log in texto show indefined, "cod" show fine value
your select incorrect. try:
var texto = $('textarea[name="'+cod+'"]').val();
Comments
Post a Comment