Is there a way to apply a function to a specific class without requiring an id? For example, in CSS hover effects, where multiple elements share the same class but only the one being hovered over is affected.
function toggleHeight(elementId, arrowId) {
var x = document.getElementById(elementId);
if (x.style.height === "60px") {
x.style.height = "1000px";
document.getElementById(arrowId).src = "picnig/arrow2.png";
} else {
x.style.height = "60px";
document.getElementById(arrowId).src = "picnig/arrow1.png";
}
}
function exp1() {
toggleHeight("port1", "ba1");
}
function exp2() {
toggleHeight("port2", "ba2");
}
function exp3() {
toggleHeight("port3", "ba3");
}