Answer the question
In order to leave comments, you need to log in
How to call the same fancybox modal in several places on the page?
A certain list of objects is dynamically generated on the site page, each of which has a "take a survey" button, which looks something like this (for example, today I have 3 such buttons on the page):
<a class="members-link perform-premiere" style="display:none; width: auto;margin: 0 0 0 0;text-align: center;" data-fancybox="simple-dialog" data-src="#dialog-content-night">
<div class="pft-api--button size-default" style="margin:auto; color:#fff; border: 1px solid rgb(0, 0, 0);">Пройти опрос</div>
</a>
<div id="dialog-content-night" style="display:none;">
<h4 align="left">Опрос</h4>
<form id="form_survey" method="post">
<p class="about">Представьтесь, пожалуйста</p>
<input placeholder="ваше имя" type="text" name="sname" id="survey_name">
<p class="about">Укажите, как с вами можно связаться</p>
<input placeholder="номер или email" type="text" name="semail" id="survey_email">
<p class="about">Сколько вы готовы потратить на билет</p>
<input type="range" name="sprice" min="300" max="15000" value="3000" step="100" id="survey_price" onchange="document.getElementById('rangeValue').innerHTML = this.value+'рублей';">
<p class="about" id="rangeValue">3000 рублей</p>
<button id="survey_submit">ОТПРАВИТЬ</button>
</form>
</div>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question