Article 6D58K can't get .on("submit" ... to work

can't get .on("submit" ... to work

by
pizzipie
from LinuxQuestions.org on (#6D58K)
I am using a linux machine with Ubuntu 20.04 and Firefox 115.02(64-bit) browser.

Below is the complete code I have: Before you even get to submit a value for "directory" this message appears:
Quote:
Uncaught SyntaxError: missing ) after argument list init.php:24:47
which refers to this on line 24: $("input#srcDir").on("submit".function(event) { ... I have been over this a dozen times and can't figure what stupid thig I have done. Please help !!!
Code:<!DOCTYPE html>
<html>
<script type="text/javascript" src="../../jquery/jquery-3.2.0.js"></script>
<body>

<h3>Enter directory from which photos are to be processed.</h3>

<form method="GET" action=##>

<label for="srcDir">Source Directory</label>
<input type="text" id="srcDir" name="srcDir" required="required" value="/home/rick/Desktop/imageSource" /><br>
<input type="submit" value="Submit" />

</form>

<script type="text/javascript" >

$(document).ready(function() {

var dir="";

$("input#srcDir").on("submit".function(event) {
event.preventDefault();
dir=$("input[type=text]").val();

})

$.ajax({
method: "GET",
url: "../chooseDir_v1.1.php",
data: { "dir": dir }
});

})// ready

</script>

</body>
</html>
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments