I want o use function with same name in js, basically there is one link:
<a onClick="showjury1();" >show</a>
when the user is on desktop I want this code to be executed:
if (window.screen.width >= 1150) {
function showjury1() {
document.getElementById("jury1").style.display = "block";
document.getElementById("juryline1").style.display = "none";
}
}
and when the user is on mobile or at any other resolution I want this code to be executed:
if (window.screen.width <= 500) {
function showjury1() {
document.getElementById("jury1").style.display = "none";
document.getElementById("juryline1").style.display = "block";
}
}
Is this possible? I have executed it and it gives errors; jury1 is not defined etc.