Answer the question
In order to leave comments, you need to log in
How to pass link attribute to modal window?
Greetings!
I am making an order form. The form opens in a modal window, fancybox3.
There are a lot of products on the page, making a modal window with a form for each is nonsense.
Help implement the transfer of the product name to the form, depending on the link with which it was opened.
It is necessary to extract the value of the data-zakaz attribute from the link and place it in the input with name=zakaz
<a data-fancybox data-src="#modal" data-zakaz="Название товара 1" href="javascript:;">Заказать</a>
<a data-fancybox data-src="#modal" data-zakaz="Название товара 2" href="javascript:;">Заказать</a>
<a data-fancybox data-src="#modal" data-zakaz="Название товара 3" href="javascript:;">Заказать</a>
<div style="display: none;" id="modal">
<form action="">
<input type="text" value="" name="zakaz">
</form>
</div>
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