验证甜蜜警报中的输入

时间:2019-07-28 07:36:24

标签: javascript html typescript sweetalert2

我在asp.net应用程序中使用了甜蜜警报以及敲除功能。我想验证输入字段是否为空白,并且在我的打字稿模块中没有无效的电子邮件格式

    SendNEwAddressToUser = (data: any, event: Event) => {
        swal({
            title: 'Sending new address',
            html: "<table>" +
            "<tr>" +
            "<td><label>Address</label></td> " +
            "<td><input type = 'text', id = 'newAddress'></input></td> " +
            "</tr>" +
            "</table>",
     type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes change",
            cancelButtonText: "Close"
        }).then(result => {
            if (!result.value)
                return;
            //write logic. fetch values from input box


            swal({
                title: "Address changed",
                type: "success",

            });
        });
    };

有人知道如何验证吗?我尝试使用inputvalidator但没有帮助?

0 个答案:

没有答案