Conditional Ternary Operator:
if countryName == "INDIA" {
document.getElementById("test").style.display = ""
}
else{
document.getElementById("test").style.display = ''none.
}
I would like to suggest for hiding HTML Elements using Conditional Ternary operator. Just try the below line for showing or hiding the HTML Elements
test ? expression1 : expression2
Example:
document.getElementById("test").style.display = (CountryName=="INDIA" ? "" : 'none')
No comments:
Post a Comment