Good evening, use the jquery function keypress
keycode = 13 for enter.
The function .slice(-8)
will retrieve the last 8 characters typed for the "/rules check"
<!DOCTYPE html>
<html>
<head>
<title>Exemplo</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script>
$( document ).ready(function() {
$("#emsg").keypress(function (e) {
var key = e.which;
if(key == 13) {
console.log($("#emsg").val().slice(-8));
if ($("#emsg").val().slice(-8) == "/regras") {
window.open('www.google.com', '_blank');
}
}
});
});
</script>
<body>
<textarea id="emsg"></textarea>
</body>
</html>
Remember that when using jquery you should put your methods inside $( document ).ready(function() {});
I’m sorry, I don’t understand. I could describe what you intend to do ?
– Ikaro Sales