Reputation: 305
i have the code below on a live site. what the form button is suppose to do is transfer the parameters to a .js file and send it to the model for insertion. but the code/form wont just allow or read the .js file
<form id="contactform" name="contactform">
<div class="contact-form-txt"> Contact Form</div>
<p>
<label for="name">Full Name *</label>
<input id="name" type="text" name="name" required="">
</p>
<p>
<label for="company">Company Name</label>
<input id="company" type="text" name="company" required="">
</p>
<p>
<label for="phone">Phone Number </label>
<input id="phone" type="text" name="phone" required="">
</p>
<p>
<label for="email">Email Address *</label>
<input id="email" type="text" name="email" required="">
</p>
<p>
<label for="profile">Question</label>
<textarea name="profile" id="profile" required=""></textarea>
</p>
<button id="submit">Submit</button>
<!-- <button> submit </button> -->
</form>
the loading contact.js file is in the header file. `
<script type="text/javascript" src="<?php echo URL ?>/public/js/contact.js"></script>`
and the jquery file that i want to load is..
$(document).ready(function() {
alert("plssssss");
$(document).on("click", "#submit", function(event) {
});
});//document ready
Upvotes: 0
Views: 712
Reputation: 551
I think you forgot to add jQuery library.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
alert("hello");
});
</script>
Upvotes: 1
Reputation: 333
the jQuery should be:
$(document).ready(function() {
alert("plssssss");
$(document).on("click", "#submit", function(event) {});
});
Upvotes: 0
Reputation: 551
The javascript should be
$(document).ready(function() {
alert("plssssss");
$(document).on("click", "#submit", function(event) {});
});
Upvotes: 0