Cannot Get JS File to be Added in my HTML
So I had this working perfectly fine, but now for some reason I can't get the jQuery validate plugin to load, and therefore am unable to use the validate
method.
Clicking on this link to it opens it fine,
But it does not show in Chrome's resources tab:
Here's the code I am currently using in the head
.
<script src="js/jquery-1.4.2.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery-validate.js" type="aplication/x-javascript" charset="utf-8"></script>
<script src="js/jquery-ui-1.8.12.custom.min.js" type="application/x-javascript" charset="utf-8"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
showOn: "both",
buttonImage: "css/images/calendar.gif",
buttonImageOnly: true,
minDate: 0
});
});
</script>
<script type="text/javascript" >
开发者_如何学Python $(document).ready(function() {
$("#mainForm").validate({
rules: {
name: "required",// simple rule, converted to {required:true}
email: {// compound rule
required: true,
email: true
},
url: {
url: true
},
comment: {
required: true
}
},
messages: {
comment: "Please enter a comment."
}
});
});
</script>
Would love any help I could get right now!
The 'type' attribute of the script needs to be text/javascript
- you have that one and the next as application/x-javascript
. I suggest changing that and see if it works.
You can just remove the type attribute, actually - all browsers will assume it's text/javascript
.
Edit: I tested and having the type be 'application/x-javascript' works - the browser runs the script. But notice the validation script tag has 'aplication/x-javascript'. 'application' is misspelled.
精彩评论