If $ is not recognized, it means that jquery is not imported correctly, you can:
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
It is best to use the full path for files imported under assets:
${pageContext.request.contextPath}/assets/js/jquery-3.2.1.min.js