I have a script that is now working, but there's still conflict with other scripts on page that I have no control over... (hosted e-com site with limited access) - is there a way to accomplish this, but with plain javascript?
var $b = jQuery.noConflict(true);
var d = new Date();
var dayOfWeek = d.getUTCDay();
var hour = d.getUTCHours();
var mins = d.getMinutes();
var status = 'open';
if (dayOfWeek !== 6 && dayOfWeek !== 0 && hour >= 12 && hour < 22)
status = 'open';
else
status = 'closed';
if (status=='open')
$b('.orderby').show();
else
$b('.orderby').hide();
You only have 1 tiny bit of jquery in your code
if (status=='open') {
$b('.orderby').show();
}else{
$b('.orderby').hide();
}
This can be converted to
if (status=='open') {
document.querySelector('.orderby').style.visibility = "visible";
}else{
document.querySelector('.orderby').style.visibility = "hidden";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With