N
N
Nikita Ivanov2015-06-07 10:53:27
JavaScript
Nikita Ivanov, 2015-06-07 10:53:27

Why doesn't js see the link from the content of the Yandex map tag?

The bottom line is this:
I create a map , create a label on it, in the contents of the balloon I write:

balloonContent: "<a href='#' idparam='2' class='zapis-create'>Записаться</a>",

Here it is:
06b709d63607444caf5ae204d77d2296.PNG
When clicked, it should open a modal window with functionality, the class "zapis-create" and "idparam='2'" is responsible for this, but it does not do this.
Such a link is outside the map and it does its job perfectly :
bc43321c57e1473981dd62175caf2ef5.PNG

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2015-06-07
@HaJIuBauKa

var open = function(e){
        var id = $(this).attr("idparam");
        $("#krasticket #krasticketMainPopup").addClass("krasticketPopupOpen");
        self.loadFrame(id);
    }

    window.addEventListener("message",listenMessage,false);
    $("#krasticket #closebutton").on("click",close);
    $(".zapis-create").on("click",open);

Binding does not work for you on these links. One solution:
Rewrite the open function to accept an idparam parameter. On click on the link in the balloon, call this function with a parameter.
or after the map is generated, try calling the binding again:
There is an extra single apostrophe in the markup `
Here is the corrected code - it works:
89eccb4a5f594a658d4a6b9c90b20b55.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question