change text daily based on day and time of day

前端 未结 3 972
太阳男子
太阳男子 2021-01-26 01:51

I\'m pretty new to JavaScript but am trying to have a text change according to the time of day, and display different text based on the day.

currently, I\'m stuck figuri

3条回答
  •  -上瘾入骨i
    2021-01-26 02:45

    $("#open_close").html(function(){ 
      if (openClosed == True)
      { return "we are open now"; }
      else
      { 
        switch(dayOfWeek) {
        case 1:
        $("#open_close").html("open at 11am");
        break;
        case 2:
        $("#open_close").html("open at 1am");
        break;
        default:
        $("#open_close").html("close");
      } 
    
      } 
    });
    

提交回复
热议问题