0

So i am trying to open my modal when a password/username is entered wrong. I have searched google but i can't come up with a good solution on how to do this with W3.CSS. My modal is being opened by an ID called "id01" and then i tried a small javascript that i found on stackoverflow in : Open modal with # in url. After trying to edit it with the help of W3.CSS to :

function popModal() {
    modal.style.display = "block";
}

var hash = window.location.hash;
if (hash.substring(1) == 'id01') {
    popModal();
}

It still didn't work. So to make a long story short. How do i make the modal go open when there is like : "#1234" in the url?

Community
  • 1
  • 1

1 Answers1

0

Try this:

            $( document ).ready(function() {
                //console.log( window.location.href );

                if(window.location.href.indexOf("#1234") > -1) {
                    alert("your url contains #1234");
                    popModal();
                }



            });
T.Shah
  • 2,768
  • 1
  • 14
  • 13