I have weekday jQuery UI tabs as follows which I want to open on the current weekday:
<div id="tabs">
<ul>
<li><a href="monday.php">Monday</a></li>
<li><a href="tuesday.php">Tuesday</a></li>
<li><a href="wednesday.php">Wednesday</a></li>
<li><a href="thursday.php">Thursday</a></li>
<li><a href="friday.php">Friday</a></li>
<li><a href="saturday.php">Saturday</a></li>
<li><a href="sunday.php">Sunday</a></li>
</ul>
<script type="text/javascript">
$(function() {
$( "#tabs" ).tabs({
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
"If this wouldn't be a demo." );
}
}
});
});
</script>
I want the tabs to open on the current day of the week, I know something like this works:
.eq((new Date().getDay() || 7) - 1).click();
But can't get it to work and would appreciate some help. Also, I would like the tab for the current day to display the word 'Today' instead of the weekday.
I would appreciate some help.
Thanks,
Brendon