[英]jquery is not working in aspx page
I want to call one jquery function in an input button click event in aspx page. 我想在aspx页面的输入按钮单击事件中调用一个jquery函数。
here is the code, 这是代码,
<input type="button" id="filter" name="filter" value="Filter" />
<script type="text/javascript">
$(function () {
$("#filter").click(function () {
alert('clicked!');
});
});
</script>
this code is working in other page like html. 此代码可在其他页面(如html)中使用。 but it is not working in aspx page. 但在aspx页面中不起作用。
I dont know that why this code is not working in aspx page 我不知道为什么这段代码在aspx页面中不起作用
Thanks. 谢谢。
As per your comment It is showing "ReferenceError: $ is not defined" of message
you need to include the jquery library in your aspx page . 根据您的评论It is showing "ReferenceError: $ is not defined" of message
您需要在aspx页面中包括jquery库。
$(function () { $("#filter").click(function () { alert('clicked!'); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="button" id="filter" name="filter" value="Filter" />
<script type="text/javascript">
$(function () {
$("#filter").click(function () {
alert('clicked!');
return false;
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.