innerHTML not working with classname in JS

innerhtml, javascript

Solution

`document.getElementsByClassName("catlink")`is selecting all the elements in webpage as array therefore you have to use [0]

 function showDiv( discselect ) 
 { 

 if( discselect === 1) 
 { 
 alert(discselect); // This is alerting fine 
 document.getElementsByClassName("catlink")[0].innerHTML = "aaaaaaqwerty"; // Now working 
 } 
 }

Problem

My drop down List to select particular value- ``` <select name="category" id="category" onChange="showDiv(this.value);" > <option value="">Select This</option> <option value="1">Nokia</option> <option value="2">Samsung</option> <option value="3">BlackBerry</option> </select> ``` This is the div where i want to show the text `<span class="catlink"> </span>` And this is my JS function - ``` function showDiv( discselect ) { if( discselect === 1) { alert(discselect); // This is alerting fine document.getElementsByClassName("catlink").innerHTML = "aaaaaaqwerty"; // Not working } } ``` Let me know why this is not working, and what i am doing wrong?

Original source