Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
jQuery click on leaflet map is working the first time, but not the second

EDIT : I have recreated the issue on this website, if you want to check : http://leafletdev1.id-interactive.info/

I am truely sorry, i saw a lot of posts that looks like my problem, but none of them are working as I think it is not exactly related on the same subject. I am pretty sure my issue is somehow linked to this : jQuery Click Working Once, not Twice, but... I am a real newbie in ajax, and I can't really understand everything of what is going on here...

I have a wordpress website that is using the freemium version of the plugin Leaflet Maps Marker v3.12.4. Here, I am displaying a map, with popups that open when I click the marker linked to them :

enter image description here

What I am trying to achieve, is that when I click on a "Bouton d'action" button, it click the marker in order to open the popup. And it is actually working, except that when I move on the map, zoom, dezoom, or do any actual action, the clicks won't work anymore, and no more popups will open.

enter image description here

Here is my code :

$(document).ready(function () {
    $('.marker1').click(function () {
        let d = 250;
        setTimeout(function () {
            let markersDOM = $('.leaflet-marker-pane img');
            let marker = null;
            let markerTitle = null;

            for (var i = 0; i < markersDOM.length; i++) {
                markerTitle = markersDOM[i];
                marker = markersDOM[i].getAttribute("title");
                if (marker === "marker1") {
                    $(markerTitle).click();
                }
            }
        }, d);
    });
});

Do you know what is happening here ? I am a little lost...

Thanks a lot for reading this.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!