Kann mir jemand sagen, warum dieser Code nicht funktionieren würde? Ich habe eine Eingabe und ich versuche, das Wetter zu überprüfen oder nicht die Eingabe ist "Start". Also tue ich ... wie auch immer nichts funktioniert - nicht einmal das .ready, aber ich bin neu, also habe ich keine Ahnung, was das Problem ist.
HTMLjQuery .ready funktioniert nicht
<form id="inputForm" onsubmit="return false;">
<input id="input" type="text" size="30" autofocus="autofocus" maxlength="100" autocomplete="off"/>
</form>
JS:
var input = "";
$(document).ready(function() {
$("#inputForm").submit(function() {
input = $("#input").val().toUpperCase();
if (input === "START") {
alert("worked");
}
$("#command_input").val("");
})
});
Können Sie bitte Alert (Eingabe) und sagen Sie mir, was es warnt? – Erick
Der Code scheint richtig. Wann tritt das Problem auf? Ist "Input" etwas? Wird das Formular gesendet? –
Haben Sie jQuery importiert? jQuery ist nicht auf Lager JavaScript. Es ist eine Bibliothek. – 4castle