I know this is probably really simple but I'm just starting out and I can't seem to make the connection between the material on the subject and actually getting it to work.
I just want to pass the values contained within my input boxes into the paragraph field below after the submit button is clicked. I got it to work with hardcoded values but I can't seem to get any variables to pass into it.
<!DOCTYPE html>
<html = "en">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/dustmonitor/script/c3.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<head>
<title> Test entry form webpage </title>
</head>
<body>
<form id="form1">
Start Datetime:<br>
<input type="text" name="startDate" id="startDate" class="Date"><br>
End Datetime <br>
<input type="text" name="startDate" id="endDate" class="Date"><br>
Parameter<br>
<input type="checkbox" class="parameter" value="PM2.5">PM2.5<br>
<input type="checkbox" class="parameter" value="PM10">PM10<br>
<input type="submit">
</form>
<script>
$(document).ready(function(){
//alert("inside first");
$("#form1").submit(function(){
//alert("inside submit");
var startD = $(".Date");
$(function).text(.startD);
//event.preventDefault();
alert("after");
});
});
</script>
<p> </p>
</body>
</html>
I commented out the event.preventDefault because I wasn't getting to the alert that was after it so I figured I was using that incorrectly as well.
I'm pretty sure my issue is coming from the .text attempt and that my variable is being stored well.
Thanks for the help.