I have been trying to call my function in the 'onsubmit' part of my form however, whenever I execute my application the alert is not appearing when searching an empty string.
When the function is written in the razor page itself (using script tags), it works fine. It seems like if I separate this function in its own javascript file, it does not want to work.
Razor Page Code:
My Javascript file:
function CheckForBlank() {
if (!document.getElementById("searchInput").value.trim().length) {
alert("Please enter a card name.");
return false;
}}
Any help on this would be very much appreciated.
Aucun commentaire:
Enregistrer un commentaire