加这个
inputType: “password”
function login(){
swal({
title: "请输入登陆密码",
type: "input",
inputType: "password",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
cancelButtonText : "取消",
confirmButtonText: "确定",
closeOnConfirm: false,
inputPlaceholder: "请输入登陆密码"
},
function(inputValue){
if (!inputValue) {
swal.showInputError("请输入验证信息!");
return false
}
$.ajax({
type : 'post',
url : '/xxxxx/xxxxx',
data : {pws : inputValue},
success : function(result) {
if (success(result)) {
swal({title:"验证通过", type: "success"}, function() {
//登陆xxxx
});
} else {
swal({title: '密码错误', type: "error"});
}
}
})
});
}
效果图: