I am trying to make my own bootleg bash clone in JS and PHP, but I am stuck on a problem. When trying to execute this script, error log tells me that enteredCommand() is not defined, even though you can see it being above the form.
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(function(){
if($(".command") !== null){
function enteredCommand(){
}
} else{
// do nothing
}
});
</script>
<form id="commandField" onsubmit="return enteredCommand();">
<p>bbash~ User:</p>
<input class="command" type=text>
</form>
Please help! I am new. This is not a duplicate, since I don't see how it can't be defined. And yes, the console specifies that the error happens at "onsubmit".