How to condense onclick code to be dynamic
Posted
by
opbeta
on Stack Overflow
See other posts from Stack Overflow
or by opbeta
Published on 2012-09-16T21:35:15Z
Indexed on
2012/09/16
21:37 UTC
Read the original article
Hit count: 262
I am trying to get this onclick function code to be dynamic. I do not want to have 50 blocks of code for all the states. He is a quick snippet of the code
var Ohio=function(){
document.getElementById('texas').style.display='none';
document.getElementById('florida').style.display='none';
document.getElementById('ohio').style.display='block';
}
and so on and so forth..... How would I go about condensing this to make it smaller and dynamic?
© Stack Overflow or respective owner