The search bar only works when I type in it and hit enter but if I copy a word from a different website and paste it, it wont search UNLESS I click on it edit(by putting a space then deleting the space) only then I'm able to press enter key. I added the script so people wouldn't just hit enter with it being empty but now I think its messing up the search bar.How could I copy and paste a word with out me having to edit it?
Edit:
<form action='/search.php' method='GET'>
<input id='searchbar' type='text' name='search' placeholder="search for movies & shows" maxlength="50" required />
<input id='submit' type='submit' name='submit' value='Search' disabled />
</form>
<script>
document.getElementById('searchbar').onkeypress = function() {
document.getElementById('submit').disabled = !this.value.trim();
}
</script>