Ok so I have a code that would show different forms based on dropdown selection
Here\'s the fiddle to that..
Well its always giving me Test1 which means its not cha
Jsfiddle is running your script .onload of the window
object, without you realizing it. This allows your script to pause on execution until the DOM is ready to be manipulated.
To have it work in your own environment, you can:
)Leave your code above the and run it onload of the window object, e.g.
window.onload = function () {
document.getElementById('options').onchange = function () {
var i = 1;
var myDiv = document.getElementById(i);
while (myDiv) {
myDiv.style.display = 'none';
myDiv = document.getElementById(++i);
}
document.getElementById(this.value).style.display = 'block';
};
}