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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -