JSFiddle - React, Tailwind, and code Playground

by pramendra

HTML

<html>
    <head></head>
    <body>
        <form name="f" method="post" action="#" onsubmit="return checkForm();">
            <input type="text" name="zoom_query">
            <input type="submit" name="submit"> 
        </form>
    </body>
</html>

JavaScript

/*
function checkForm(f) {
    if (f.elements['zoom_query'].value == "" || "Search - Movie or Actor") {
        f.zoom_query.focus();
        return false;
    } else {
        f.submit();
        return false;
    }
}
*/
function checkForm() {
    if (f.zoom_query.value == "" || f.zoom_query.value == "Search - Movie or Actor") {
        alert("Please fill in the text field.");
        f.zoom_query.focus();
        return (false);
    }
    f.submit();
    return (true);
}