简体   繁体   English

将JQuery与母版页一起使用

[英]Using JQuery with Master Page

I am trying to use JQuery in Master Page. 我正在尝试在母版页中使用JQuery。 I do not get any error, but the JQuery is working. 我没有收到任何错误,但是JQuery正在运行。 I am trying to use Table Sorter function. 我正在尝试使用表排序器功能。

MasterFile:
    <head runat="server">
    <script src="../js/libs/jquery.tablesorter.js" type="text/javascript"></script>

    <script type="text/javascript">

     $( document ).ready( function ( $ ) {
    $(".tablesort").tablesorter();
     });
        </script> 


.cs FIle (Using Master Page)
<uc1:CERDisplayControl ID="displayControl" runat="server" class="tablesort" />

When I try to load the page, I do not get any error but the contents are not loaded properly. 尝试加载页面时,没有出现任何错误,但内容未正确加载。

The $ in the parameter for the function handler is probably redefining $ as something other than the normal value of the jQuery object. $在功能处理函数的参数可能是重新定义$为比jQuery对象的正常价值以外的东西。 Remove it from the parameters and see what you get. 从参数中删除它,然后看得到什么。

$(document).ready(function($ /* <-- here*/ ){ }

Sample: 样品:

$(function(){  /*this is shorthand for $(document).ready(function(){ */
    $(".tablesort").tablesorter();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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