私のjsfiddle https://jsfiddle.net/fp2vg48z/2/をご覧ください
コードは次のとおりです。
$('a').click(function(){
$( "#container" ).dialog({
height: 430,
width: 620,
title: 'click hello',
modal: true,
buttons: [
{
text: 'Back',
click: function() {
$( this ).dialog( "close" );
}
}
],
create: function( event, ui ) {
},
close: function( event, ui ) {
}
});
});
$('.justalert').click(function(){
swal({
title: 'hello',
text:'Please enter name',
type:'input',
showCancelButton: true,
closeOnConfirm: false,
inputPlaceholder: "E.g john"
}, function(inputValue){
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("You need to enter something!");
return false;
}
swal({title: " success " + inputValue+" added!", type:"success", timer:10000 });
});
});
$(document).on('click','.hello',function(){
swal({
title: 'hello',
text:'Please enter name',
type:'input',
showCancelButton: true,
closeOnConfirm: false,
inputPlaceholder: "E.g john"
}, function(inputValue){
if (inputValue === false)
return false;
if (inputValue === "") {
swal.showInputError("You need to enter something!");
return false;
}
swal({title: " success " + inputValue+" added!", type:"success", timer:10000 });
});
});
CSS:
#container{ padding:20px; background:#ccc;display:none;}
.sweet-overlay{z-index:5000;}
.sweet-alert{z-index:5001;}
モーダルの上にあるときに甘いアラートがトリガーされると、入力はフォーカスされません。上部のテキストを選択することはできますが、フォーカスがありません。これが甘い警告によるものかどうかはわかりません。
それ以外の場合、入力は正常に機能します。
何か案は?