anthonydoan anthonydoan - 1 year ago 206
CSS Question

Disable input Textbox in Sweet Alert when use showLoaderOnConfirm

I am using Sweet Alert plugin to create a button and create a popup to delete a something
I would like to disable textbox when the delete process is running, and i dont know how to do, anyone lead me?

jQuery("#vbb_btn_delete_post").on("click", function(e) {
title: "Lý do xóa bài",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top",
inputPlaceholder: "Write something",
showLoaderOnConfirm: true,
customClass: "mySwall"
if (inputValue === false) return false;
if (inputValue === "") {
swal.showInputError("Bạn cần nhập lý do"); return false;
$('.mySwall').find(':text').prop('disabled', true); //it not working ???
url: "{vb:raw postinfo.postid}",
type: "POST",
data: {
"dodelete": "1",
"deletepost": "delete",
"reason": inputValue,
"securitytoken": "{vb:raw bbuserinfo.securitytoken}",
"p": {vb:raw postinfo.postid},
"url": "{vb:raw url}",
"do": "deletepost",
"posid": {vb:raw postinfo.postid},
"forumid": {vb:raw $GLOBALS.forumid}
dataType: "html",
success: function () {
swal("Done!","It was succesfully deleted!","success");
window.location=""+{vb:raw $GLOBALS.forumid};
//swal("Nice!", "You wrote: " + inputValue, "success");

Answer Source

To disable textbox use:

$("input").prop('disabled', true);
$("input").prop('disabled', false);