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

196
Views
How to close a div on click in vue js?

I have added a close button to a div in Calendly popup in VueJS and I want to close this div when click on the close button. How can I do this?

This is my Calendly Code:

<TransitionRoot as="template" :show="openTimes">
<Dialog
  as="div"
  class="fixed inset-0 overflow-y-auto"
  @close="closeModal"
  :open="openTimes"
  :initialFocus="closeModalTimesRef"
>

And this is the button I have added

<button type="button" class="close" 
@click="$emit('close')"> X 
 </button>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You probably want to use the v-if directive (or other methods of conditional rendering available in the link).

Usually you set a key like: showDialog: true in your data/state object and add it to your dialog and catch the close event like so:

<script>
  data() {
    return {
      showDialog: true;
    };
  },
</script>
<template>
  <dialog
    v-if="showDialog"
    @close="showDialog = false;"
  />
</template>
about 4 years ago · Juan Pablo Isaza Report

0

You can use something like this :

<button onclick="showOrCloseDiv()">Click The Button</button>
<div id="thedivid">
JS tuto
</div>
<script>
   function showOrCloseDiv() {
      var v = document.getElementById("thedivid");
      if (v.style.display === "none") {
         v.style.display = "block";
      } else {
         v.style.display = "none";
      }
   }
</script>

about 4 years ago · Juan Pablo Isaza Report
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!