I Have this code:
<script type="text/javascript">
$(document).ready(function () {
$("#NextFrom").click(function () {
alert('hi');
})
});
</script>
<form action="/Book" id="bookform" method="post">
<a class="btn btn-lg btn-success btnNext pull-right" value="next" aria-controls="to" id="NextFrom" href="#">NEXT</a>
</form>
But for some reason the event is not triggered.
What am I doing wrong?
I'm using the following jQuery scripts:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="/Scripts/vendor/jquery-1.11.4.ui.min.js"></script>
<script src="/Scripts/jquery.validate.min.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.min.js"></script>
semi colon was missing..
$(document).ready(function () {
$("#NextFrom").click(function (event) {
alert('hi');
});
});
I tried your code on my side, and everything seems to work. I think your problem came from the jquery inclusion, check this link to see if the jquery is indeed well included or not :
http://jquery-howto.blogspot.fr/2009/03/check-if-jqueryjs-is-loaded.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.