У меня есть div с классом модальной оболочки, который создает наложение на странице.
У div есть всплывающее модальное окно, которое открывает форму HTML с идентификатором модальной обратной связи. Модал располагается в центре страницы, используя CSS. Форма имеет кнопку отправки с идентификатором отправки, которую я слушаю с прослушивателем событий при отправке. Эта кнопка отправки не работает.
Когда я удаляю эту форму из модальной оболочки, она работает нормально. Что мешает отправить кнопку отправки? Кто-нибудь может подсказать мне, как подойти к этой проблеме?
Я пытался найти ответы на многие вопросы, связанные с этим вопросом, но ни один из них не затрагивал мою проблему.
Это мой html разметка.
<div id="modal_wrapper" class="modal_wrapper">
<div id="modal_window">
<div style="text-align: right;"><a id="modal_close" href="#">close <b>X</b></a></div>
<p class="better-exp-p" id="better-exp-p">Select House Type:</p>
<form id="modal_feedback" method="POST" action="<?php echo url_for('/landing_page.php') ;?>">
<span class="buy-let-furnished">
<label for="buy" class="buy-let-furnished-label">Buy</label>
<input class="selector" id="buy" name="buy-let-furnished" type="radio" value="1">
<label for="let" class="buy-let-furnished-label">Let</label>
<input class="selector" id="let" name="buy-let-furnished" type="radio" value="2">
<label for="let" class="buy-let-furnished-label">Fully Furnished</label>
<input class="selector" id="furnished" name="buy-let-furnished" type="radio" value="3">
</span>
<span class="Bedrooms">
<p>Number of Bedrooms :</p>
<label for="onebedrooms" class="bedrooms-label">1</label>
<input class="selector" id="onebedrooms" name="bedrooms" type="radio" value="1">
<label for="twobedrooms" class="bedrooms-label">2</label>
<input class="selector" id="twobedrooms" name="bedrooms" type="radio" value="2">
<label for="threebedrooms" class="bedrooms-label">3</label>
<input class="selector" id="threebedrooms" name="bedrooms" type="radio" value="3">
<label for="morethanthreebedrooms" class="bedrooms-label">more than 3 </label>
<input class="selector" id="morethanthreebedrooms" name="bedrooms" type="radio"
value="4">
</span>
<span class="location">
<label for="area" class="area-head">Location </label>
<input class="selector" id="location" name="location" type="text" value="">
</span>
<button type="submit" class="better-exp-p submit" id="submit" name="feedbackForm"
value="submit">Search</button>
<button id="expand" type="expand" name="feedback-expand-Form" value="More-search">More Detailed
Search</button>
</form>
</div> <!-- #modal_window -->
</div> <!-- #modal_wrapper -->
<!----js file --->
document.getElementById('modal_feedback').addEventListener('submit', validate);
validate(e){
e.preventDefault();
console.log('was clicked')
console.log(this);
}
Когда я нажимаю на кнопку, форма не отвечает