I want to display a review form in the modal popup on the click of a button. However, the code gives this error
Uncaught TypeError: No method named "openModal"
I am using bootstrap.bundle.js
in my application. If I remove that the popup is displayed without any error message.
Code I am using:
<div>
<a href="#" id="click-me">Click Me</a>
</div>
<div id="popup-modal" style="display:none;">
<?php echo $this->getLayout()->createBlock("Magento\Review\Block\Form")->setTemplate("Magento_Review::form.phtml")->toHtml(); ?>
</div>
<script>
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
) {
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: 'popup modal title',
buttons: [{
text: $.mage.__('Continue'),
class: '',
click: function () {
this.closeModal();
}
}]
};
var popup = modal(options, $('#popup-modal'));
$("#click-me").on('click', function () {
$("#popup-modal").modal("openModal");
});
}
);
</script>
$("#popup-modal").modal();
instead of$("#popup-modal").modal("openModal");
?