jquery - display days of the week javascript -
i display in list days of week. current day want display word today. how can javascript?
<ul class="week-days"> <li><a href="#"><span id="firstd">today</span></a></li> <li><a href="#"><span id="secondd">tue</span></a></li> <li><a href="#"><span id="thirdd">wed</span></a></li> <li><a href="#"><span id="forthd">thu</span></a></li> <li><a href="#"><span id="fifthd">fri</span></a></li> <li><a href="#"><span id="sixthd">sat</span></a></li> <li><a href="#"><span id="seventhd">sun</span></a></li> </ul>
you can accomplish adding @ bottom of page (just above body closing tag)
<script type="text/javascript"> var = 1; $('.week-days li').each(function(){ if ((new date()).getday() == i) { $(this).val('today').html('today'); } i++; }); </script>
Comments
Post a Comment