I have dynamic table with data from the server, and in the table I have some textareas. Now, I would like to check when the user starts writing in one of them and when the user deletes all the text in all of them.
I tried something like this but I cant get it to count and its taking the value of only on textarea:
<?php foreach ($arr_cases as $cases) : ?>
<tr>
<td>
<div id="wrapper">
<textarea class="manuf_comment" name="manuf_comment[<?php echo $cases["Dev_Id"] ?>]" oninput="display_hide_save_button()" placeholder="Comment here" maxlength="500" rows="2" cols="50"><?php echo $cases["manuf_comment"]; ?></textarea>
</div>
</td>
</tr>
<?php endforeach; ?>
the javascrit function that I am calling:
function display_hide_save_button(cb) {
var on_input_text = document.getElementsByClassName("manuf_comment");
if (on_input_text.length > 0) {
alert("The user started writting")
} else {
alert("The user has erased everything")
}
}