Arbeits I BootstrapDialog Bibliothek verwenden modale Dialoge eine Bestätigungsmeldungen eine Warnmeldung angezeigt I BootstrapDialog.confirm Methode Seite eine andere Funktion mit einigen Parametern wie Button Text wieder zu verwenden verwenden, Nachrichtentext etc. ... für diesen schreibe ich bellow code zu testzwecken, aber die funktion gibt nichts zurück immer undefined.BootstrapDialog bestätigen in einer anderen Funktion nicht
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/css/bootstrap-dialog.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap3-dialog/1.34.7/js/bootstrap-dialog.min.js"></script>
<script>
function callconfirm()
{
// var isConfirmed
BootstrapDialog.confirm({
title: 'WARNING',
message: 'Warning! Drop your banana?',
type: BootstrapDialog.TYPE_WARNING, // <-- Default value is BootstrapDialog.TYPE_PRIMARY
closable: false, // <-- Default value is false
draggable: false, // <-- Default value is false
btnCancelLabel: 'Do not drop it!', // <-- Default value is 'Cancel',
btnOKLabel: 'Drop it!', // <-- Default value is 'OK',
btnOKClass: 'btn-warning', // <-- If you didn't specify it, dialog type will be used,
callback: function(result) {
// result will be true if button was click, while it will be false if users close the dialog directly.
if(result) {
return true;
}else {
return false;
}
}
});
}
function checkConfirm()
{
var v=callconfirm();
console.log(v);
}
</script>
</head>
<body>
<button type="button" value="click" onclick="checkConfirm()" style="height: 50px;width: 50px" />
</body>
'callconfirm' gibt nichts zurück, so ist es die Rückkehr' undefined'. Möchten Sie stattdessen den Wert von 'BootstrapDialog.confirm' zurückgeben? – Agalo
Ja, ich möchte erhalten bestätigt oder falsch, um nächsten Schritt – matrixwebtech
Ich habe eine Antwort geschrieben, überprüfen Sie, ob es für Sie funktioniert. – Agalo