0

I would like to get a lightbox modal box to pop up automatically on page load.

My current anchor works perfect when I actually click it, and here is my bit of JQuery that I've been using so far.

<script>
$(document).ready(function(){
      document.getElementById('popup').click();
});
</script>

And the HTML

<a id="popup" class="wb-lbx lbx-modal" href="#alert">test</a>
      <section id="alert" class="mfp-hide modal-dialog modal-content overlay-def">
        <div class="alert alert-info">
          <h2 class="h4">header</h2>
          <p>content</p>
          </div>
      </section>

Problem is, it just brings me to the #popup anchor location on the page, not actually triggering the lightbox that pops if you were to actually click it.

How do I trigger the click event on page load?

Thanks

JonYork
  • 1,223
  • 8
  • 31
  • 52

0 Answers0