【转】在sweetalert中 加入html代码


原文地址:https://www.cnblogs.com/HwChinchilla/p/8942092.html

$(".demo_5 button").click(function() {
swal({
title: "Good!",
text: '自定义<span style="color:red">图片</span>、<a href="#">HTML内容</a>。<br/>5秒后自动关闭。',
imageUrl: "images/thumbs-up.jpg",
html: true,
timer: 5000,
showConfirmButton: false
});
});

实战

  var html = $(obj).parent(".amount-warp").find(".divAdjustNum").html();  
        swal({
            title: "调整XX数量",
            text: html,            
            html: true,
            showCancelButton: true,
            closeOnConfirm: false,
            animation: "slide-from-top",
            inputPlaceholder: "输入调整后的数量",
            cancelButtonText: "取消",
            confirmButtonText: "确认",
        }, function (inputValue) {
            var newNum = $(".sweet-alert #goods_number_" + rec_id).val();
            var errorDiv = $(".sweet-alert .divAdjustNumError")[0];
            if (!newNum) {
                errorDiv.innerText="数量无效!";
                return false
            }           

            if (curnum == newNum) {
                errorDiv.innerText="数量未改变!";
                return false
            };   
           //逻辑处理            
        });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM