code:
<script>
$(document).ready(function(){
$(".check").click(function(){
comment = $(".comment2").val();
alert(comment);
});
});
</script>
<?php
$sql = "select * from enquires2";
$result = mysqli_query($link,$sql);
while ($row = mysqli_fetch_array($result))
{
echo "<tr>
<td>
<input type='checkbox' class='check' id='chk".$row['id']."' name='chk' value=".$row['id'].">
</td>
<td>
<input type='text' name='comment2' class='comment2' id='comment2_".$row['id']."' value='' />
</td>
</tr>";
}
?>
In this code when I enter text inside comment2 input field and then check checkbox it alert only 1st row value but when I enter second textbox and then again check checkbox it show nothing. So, how can I get multiple textbox value onclick on checkbox ? Please help.
Thank you