I just added the lib request to my web application and tested with a simple warning:
<script src="<c:url value="/resources/jquery-1.10.2.min.js" />"></script> <script type="text/javascript"> $(function(){ alert('jquery is working'); }); </script>
And it works great. However, when I want to implement the "change" event in my popup menu
<script src="<c:url value="/resources/jquery-1.10.2.min.js" />"></script> <script type="text/javascript"> $("#projectKey").change(function() { alert($('option:selected', $(this)).text()); }); </script>
he does not show me any warning, basically nothing happens. My dropdown is as follows:
<select id="projectKey" name="projectKey"> <option value="AM">AM</option> <option value="AIL">AIL</option> <option value="NEB">NEB</option> <option value="SSP">SSP</option> </select>
Of course I tried to simplify javascript, just leave
$("#projectKey").change(function() { alert("test"); });
but still no joy. It will be something with a selector or a dropdown. I also tried "select # projectKey", but the result was, of course, the same. Any idea what I'm doing wrong?
source share