jQuery技术:外部JS文件中的JQuery

我正在尝试在加载html页面时执行一些JavaScript。 调用top方法populateSelectWithDates(),但jquery部分不调用。 有任何想法吗?

function doInitialPopulation() { //This works populateSelectWithDates(); //This does not $(document).ready(function() { alert('ok'); //Credit to: https://www.pewpewlaser.com/articles/jquery-tablesorter // Adds sort_header class to ths $(".sortable th").addClass("sort_header"); // Adds alternating row coloring to table. $(".sortable").tablesorter({widgets: ["zebra"]}); // Adds "over" class to rows on mouseover $(".sortable tr").mouseover(function() { $(this).addClass("over"); }); // Removes "over" class from rows on mouseout $(".sortable tr").mouseout(function() { $(this).removeClass("over"); }); }); } 

    在HTML文件中,确保按此顺序包含脚本:

         

    我没有看到任何使用$(document).ready(function() {尝试删除它。让我们知道alert(’ok’)是否有效。还可以看到函数populateSelectWithDates()吗?

      以上就是jQuery教程分享外部JS文件中的JQuery相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/541353.html

      (0)
      上一篇 2021年1月3日
      下一篇 2021年1月3日

      精彩推荐