I am working in JavaScript. I am facing an issue i.e. I want to place border around a div tag dynamically. My COde is Below:
function myfunction(var1) {
if (document.getElementById(var1).style.border = "0px") {
document.getElementById(var1).style.border = "1px solid green";
} else {
document.getElementById(var1).style.border = "0px";
}
}
The code places border for first time but never removes it. i.e. else portion is not working. Any help would be appreciated.