Yes you could with Jquery Attr Selector
$('div[data-value=modalDataValue]').modal('show')
Yes you could with Jquery Attr Selector
$('div[data-value=modalDataValue]').modal('show')
Yes you can do like
$('#alarm[data-value=YOUR_VALUE_YOU_GET_VIA_PHP]').modal('show')
You can learn more about selectors at https://www.w3schools.com/jquery/jquery_ref_selectors.asp
I suggest you get the data via an ID
$(#alarm)
that is unique in the document.
I have the following function for calling the modal”
function openModal(x) {
(function ($) {
$('#alarm').modal('show');
})(jQuery);
}
and for the modal:
<div id="alarm" class="modal fade modal-alert" data-value="'.$element['eventId'].'">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Title
</div>
<div class="modal-body" id="boxPopUpPushCommand" style="text-align:left !important">
Body texts here
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Trying to open a specific modal using the data-value and not the id?