Is there any way that I can change the properties in document.getElementbyId.style with a variable that I received from the Parameters of the function?
function toggleFunction(elementId, property1, property2) {
let element = document.getElementById(elementId)
if (element.style.display == property1) {
element.style.display = property2
} else {
element.style.display = property1
}
}
The above code is not giving me the desired result. Is there a way that I can use variable values that I got from parameters for writing Properties?