I want to replace this:
<body onload="
$('input[name=startDate]').focus();
$(function () {
$('#startDate').datepicker({ dateFormat: 'mm/dd/yy'});
});
">
with inline javascript - something like:
<script th:inline="javascript">
/*<![CDATA[*/
$( document ).ready(function() {
$('input[name=startDate]').focus();
$('#startDate').datepicker({ dateFormat: 'mm/dd/yy' });
});
/*]]>*/
</script>
However, this doesn't work. The error is: ReferenceError: $ is not defined
Anyone knows how to get this to work?
please add:
before your script block.
$is part of jQuery. You need to add it's library/implementation file for to use it.