javascript - How to get all text from all textboxes with class txt_Answer -
<table id="tb_answers"> <tbody> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td colspan="4"> </tr> </tbody> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> <td> <td> </tr> <tr> <td> <input class="txt_answer" placeholder="enter answer"> </td> </tr> </table>
i got 3 inputs answers.how text/answer class txt_answer tried this
$('*[class="txt_answer"]').val()
but returns me first value not of thaem
by iterating , creating array $.map :
var values = $.map($('input.txt_answer'), function(el) {return el.value;});
you should validate html, it's not valid
Comments
Post a Comment