jquery - JavaScript that highlights current day in "hours of operation" part of website -
i have list of days , hours of operation of business:
{% load static %} <link type = "text/javascript" href="{% static 'core/js/index.js' %}"> <div class = "col-md-4"> <div class = "business-hours"> <h2 class="title">opening hours</h2> <ul class="list-unstyled opening-hours"> <li>sunday <span class="pull-right">closed</span></li> <li>monday <span class="pull-right">9:00-22:00</span></li> <li>tuesday <span class="pull-right">9:00-22:00</span></li> <li>wednesday <span class="pull-right">9:00-22:00</span></li> <li>thursday <span class="pull-right">9:00-22:00</span></li> <li>friday <span class="pull-right">9:00-23:30</span></li> <li>saturday <span class="pull-right">14:00-23:30</span></li> </ul> </div> </div>
and trying use javascript current day highlighted when user visits website:
// highlight current day on opeining hours $(document).ready(function() { $('.opening-hours li').eq(new date().getday()).addclass('today'); });
the above javascript not producing results , not sure why. note: in django project app core
, , js file located @ core/static/core/js/index.js
.
edit:
this error message shown in console:
error: bootstrap's javascript requires jquery
that error message means either jquery wasn't loaded, or wasn't loaded before bootstrap's javascript. need load jquery before loading bootstrap javascript file. script
tags should this:
<link rel="stylesheet" href="bootstrap.min.css"> <script src="jquery.min.js"></script> <script src="bootstrap.min.js"></script>
wiki
Comments
Post a Comment