Last active
July 3, 2018 07:22
-
-
Save ytyng/2991dfbfa909cc22250056ddf0afce90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* popover confirmation | |
*/ | |
(function () { | |
let $formPopoverConfirm = $('form.popover-confirm'); | |
if (!$formPopoverConfirm.length) { | |
return; | |
} | |
$formPopoverConfirm.on('submit', function () { | |
let $this = $(this); | |
let $content = $('<div>'); | |
let $executeButton = $('<button>', { | |
addClass: 'btn btn-primary btn-block', | |
text: '実行する', | |
}); | |
let $cancelLink = $('<div>', { | |
addClass: 'text-center mt-2', | |
html: $('<a>', { | |
text: 'キャンセル', | |
attr: { | |
href: '#', | |
} | |
}) | |
}); | |
$content.append($executeButton); | |
$content.append($cancelLink); | |
$this.popover({ | |
title: '実行していいですか?', | |
content: $content, | |
html: true, | |
placement: 'bottom', | |
}).popover('show'); | |
$executeButton.on('click', function () { | |
$this.off('submit'); | |
$this.submit(); | |
$this.popover('hide'); | |
return false; | |
}); | |
$cancelLink.on('click', function () { | |
$this.popover('hide'); | |
return false; | |
}); | |
return false; | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment