R
R
Roman2019-05-08 17:01:26
JavaScript
Roman, 2019-05-08 17:01:26

FancyBox 3 how to pass data from button to form?

Good afternoon.
I am slowly switching to fancyBox 3, and I run into difficulties, I ask for the help of those who know.
It is necessary to transfer data from the button to the form, before doing this:

// Ссылка
<a href="#form" class="link" data="Информация">link</a>

// Вызов JS
$(".link").fancybox({
  'afterLoad': function() {
    id = $(this.element).attr('data');
    $("#tip").val(id);
  }
});

// В самой форме
<p id="tip"></p>

When clicked, in the pop-up form, the information specified in the button was pulled into the block.
How to do the same for version 3? Provided that they have a call:
<a href="javascript:;" data-fancybox data-src="#forma" data="Информация">link</a>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question