For example here the code goes like this:
<html lang="en">
<head>
<!-- whatever -->
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<!-- whatever -->
Note that <script>
should have contained type
attribute (perhaps set to "text/javascript"
) but it is not present here.
This is not the only example I've seen. Such code makes Visual Studio editor unhappy - it underlines <script>
and says there should be a type
attribute. It also makes me curious big time.
Why is type
often omitted? What happens if I add type="text/javascript"
- will jQuery break or something?