javascript - $.jAlert 不是函数

标签 javascript jquery css

试过后,jquery confirm,现在jAlert,每次都遇到同样的错误。。 在控制台中,我得到 - TypeError: $.jAlert is not a function[了解更多]

<script src="js/jquery-3.3.1.min.js"></script>
<link href="css/jAlert.css" rel="stylesheet">
<script src="js/jAlert.js"></script>
<script src="js/jAlert-functions.js"></script>

我的按钮是...

<input type="radio" class="form-check-input" name="optionsRadios" id="mybtn" value="">

和脚本部分:

<script type="text/javascript">  
$(document).ready(function(){
$('#mybtn').on('click',function(){
    $.jAlert({
      'title': 'Nice Size',
      'content': 'This is the sized alert',
       'theme':'blue',
      'closeOnClick': true 
   });
});
</script>

我猜 jQuery 和 jAlert 是冲突的... 谁能帮忙?

最佳答案

如何使用 fn 来扩展 jquery 功能,这样你的代码就可以了

<script type="text/javascript">  
$(document).ready(function(){
   $('#mybtn').on('click',function(){
      $.fn.jAlert({
      'title': 'Nice Size',
      'content': 'This is the sized alert',
      'theme':'blue',
      'closeOnClick': true 
   });
});
</script>

关于javascript - $.jAlert 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55084910/

相关文章:

javascript - 处理回调选项在 jQuery 文件上传中不起作用

javascript - 以编程方式触发 D3 刷机事件

jquery - fillStyle 颜色的过渡

javascript - 如何使用 CSS 或 JS 让一些文本输入在输入中显示帮助图标?

javascript - 如果重新加载页面,鼠标手形光标会在 Google Chrome 中消失

javascript - jQuery 菜单悬停

javascript - Service Worker 加载资源失败:net::ERR_INTERNET_DISCONNECTED

javascript - 使用 Javascript 检测按键组合系列

jquery - 如何简化此 AddClass/RemoveClass 代码?

javascript - 为什么调用 Javascript 的 Date 库如 date.setMonth(date.getMonth()-1) 在这里返回 1426456040720?