M
M
Maybe_V2017-04-13 20:42:22
JavaScript
Maybe_V, 2017-04-13 20:42:22

How to include js only when the popup is active?

Good evening.

There was a small problem with loading js on the page. I have a popup that connects to the page like this (I know it's a dumb approach, but it happened):

<?=$this->renderAjax('modals/apply-popup',[
    'usersCollection' => $usersCollection,
    'employeeType' => $employeeType
])?>


There is a js script on it, and you need to implement (connect js ) so that it is executed only when this popup is shown.

Is it possible ? How to implement this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-04-14
@prokopov-vi

So execute the code only on the modal opening event. It doesn't matter how you render it.

M
McBernar, 2017-04-14
@McBernar

Active? Is this some new element of the periodic table? :)
And on the topic - js can connect if you just insert jquery into the code<script src="script.js">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question