I want to display "00:00" on the page but the page is empty I don't know why it's not working.
$(document).ready(function(){
var minut = $("#minut").html;
var mid = $("#mid").html;
var sec = $("sec").html;
minut = "00";
mid = ":";
sec = "00";
});
HTML
<span id="minut"></span>
<span id="mid"></span>
<span id="sec"></span>
Use .text()
to display text within the div you are querying... Check out snippit
You were also missing a #
symbol in your sec
selector.
$(document).ready(function(){ let minut = $("#minut"); let mid = $("#mid"); let sec = $("#sec"); minut.text("00"); mid.text(":"); sec.text("00"); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <span id="minut"></span> <span id="mid"></span> <span id="sec"></span>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.