简体   繁体   中英

jquery is not working in aspx page

I want to call one jquery function in an input button click event in aspx page.

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. but it is not working in aspx page.

I dont know that why this code is not working in aspx page

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 .

  $(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;
    });
});

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM