javascript 我不能弄清楚为什么我的按钮不与SweetAlert2通信

hjzp0vay  于 5个月前  发布在  Java
关注(0)|答案(1)|浏览(66)

我有一个形式问题齿轮和设备的员工.在底部,我有一个按钮,应该使用SweetAlert2弹出一个协议消息.我已经在头部部分的脚本和CSS链接.它只是当我点击按钮,什么也没发生. Im新来这一点,并假设IM错过了一些重要的东西.

<div class="mt-2">
<button  type="submit" class="btn btn-primary me-2" id="issueGear">Issue Gear</button>
<button type="reset" class="btn btn-outline-secondary">Cancel</button>
</div>

                        
<script type="text/javascript">

$(document).ready(function() {
$('#issueGear').click(function(){
Swal.fire({
type: 'success',
title: 'Agreement',
text: 'I agree to return all issued items upon my voluntary or involuntary dismissal from 
the department. If I fail to return any item(s), I may be help responsible for the 
replacement cost of the item(s).'
})
})
}
                 
</script>

字符串

kgqe7b3p

kgqe7b3p1#

“$(document).ready”中存在语法错误

<script type="text/javascript">
            $(document).ready(function() {
                $('#issueGear').click(function(){
                    Swal.fire({
                        type: 'success',
                        title: 'Agreement',
                        text: 'I agree to return all issued items upon my voluntary or involuntary dismissal from the department. If I fail to return any item(s), I may be held responsible for the replacement cost of the item(s).'
                    });
                });
            });
        </script>

字符串
然后将按钮类型更改为“按钮”

<button  type="button" class="btn btn-primary me-2" id="issueGear">Issue Gear</button>

相关问题