2

 <label class="label-set">
 <input type="checkbox" class="" name="sameadr" />
  I agree to all statements of
  <a href="#" style="color: #ee1d24"> Terms of Use </a>
  </label>

How to open popup, onclick of link. simple popup should open as soon as user click on link

1
  • window.location = url; or window.open(url); Commented Feb 20, 2021 at 12:18

2 Answers 2

1

In html give a id to your a tag.

    <label class="label-set" id="mainId">
     <input type="checkbox" class="" name="sameadr" />
      I agree to all statements of
      <a href="#" id="newId" style="color: #ee1d24"> Terms of Use </a>
    </label>

In javascript

    document.getElementById("newId").addEventListener("click", function(){
       confirm("confirm this") // or your popop code
    })

Try this for vue.js

<a href="javascript:void(0)" v-on:click="openPopup" id="newId" style="color: #ee1d24"> Terms of Use </a>

And write this inside your method

    new Vue({
      el: '#mainId',
      methods: {
        openPopup: function () {
          alert('ok')
        }
      }
    })

Try this

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for info, in vuejs how to do the same
I have not tested. but write a small code for you. check it: [previous code edited]
1

Make a modal component. Add a click to your a tag. When clicked show your modal component. After another action (confirm etc.) close and continue.

How to make a reusable modal component in Vue.js: How to make a Modal Component

1 Comment

The link given here is perfect - very detailed instructions, And it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.