How to make the event work and get the data?
Notifications are loaded in my system, with some notifications and a click on them, a modal window with data for example tasks should open.
The script that shows the modal window connects to the page at the time of its loading and waits for click events.
The code that shows the window:
// показать задачу $('.view-task').on('click', function () { var id_cabinet = $(this).data('id-cabinet'); var id_task = $(this).data('id-task'); $modal.modal('show'); $modal.addClass('modal-task'); $modal.find('.modal-body').empty().end(); ... }); Downloadable notification code with data parameters
<div data-notification="37259" data-notification-vid="tasks" class="notification-line leads view-task" data-lead-id="68413" data-id-cabinet="950" data-id-task="4318"> <div class="notification-lead-namb"><span class="ucrmicon">J</span> Задача по клиенту: #68413</div> <div class="notification-info-rem">замер</div> <div class="notification-date">Вчера в 13:00</div> </div> The code for showing the window is used on many pages of the site. How can I make minimal opening of the window so that the window opens when I click on the loaded item?