使用swal的输入框为什么样式乱了

JavaScript011

使用swal的输入框为什么样式乱了,第1张

注意定义。

弹出框样式,swal is not define

$(".noData").click(function() {

swal("暂无数据!")

})

或者复杂一点的:

swal({

title:"您没有权限修改!",

type:"warning",

showCancelButton:false,

closeOnConfirm:true,

closeOnCancel:true

})

<!--swal提示框需要的样式-->

<link rel="stylesheet" href="/css/sweet-alert.css">

<!--用以解决swal is not define问题-->

<script src="/js/sweet-alert.min.js"></script>

怎么修改js alert弹框样式方法如下:

覆盖window.alert函数,或者直接通过alert的原型来覆盖;

原理:alert 属于window 的函数,每个函数都有原型对象prototype ,只需要修改window.alert的原型对象即可改变原生alert的样子;

代码如下

window.alert.prototype = function(msg){

//some code here ,怎么改都行

alert('消息:'+msg)

}