How to check the text for the presence of predefined keywords or expressions?
There is a certain <textarea> in it there must initially be some text, then the user enters his own and if that he entered matches the keys that are predefined, we show him the button next.
In general, I sketched two small scripts, but the first works only if one keyword is present, and the second works as it should, but only if the text was entered in advance, and it does not respond to the new text.
First script
<script type="text/javascript"> function check (id, sbm) { if (document.getElementById(id).value == 'привет') document.getElementById(sbm).style.display = ''; }; </script> <form> <textarea type="text" id="pole"></textarea> <input type="button" value="Проверить" onclick="check('pole','sbm');"> <input type="submit" id="sbm" value="Далее" style="display:none"> </form> Second script
<script> $(document).ready(function (){ $(".check").click(function check(){ $("textarea:contains(привет)").html(function(){$("#next").css("display", "block");}) }); }); </script> I would be very grateful for any help, because in JS I have not been strong with this for two days.