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

159
Views
How can I show dynamically-updated content in a Bootstrap popover?

I have a Bootstrap 4.7 popover as follows. This works ok without the popover. However if I insert the id="countdown" in data-content the result is not shown. How do you fix this? Thanks a lot. PS: endTime value is just a reference, the real value is near Date().getTime().

var myfunc = setInterval(function() {
  var endTime = 6666666666
  var currentTime = new Date().getTime() / 1000 | 0
  var seconds = endTime - currentTime

  // output
  document.getElementById("countdown").innerHTML = seconds + "s "

  // when countdown is over
  if (remaining < 0) {
    clearInterval(myfunc);
    document.getElementById("countdown").innerHTML = ""
  }
}, 1000);
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">

<div class="myinfo" data-container="body" data-toggle="popover" data-html="true" data-placement="top" data-trigger="hover" data-content='<span class="style-text-mini">Submit Time:</span> 
                          <span id="countdown"></span>'>Div content</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>

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!