html5 - Reseting the height of a select HTML -


i have tag populates values based on click of 1 of 27 buttons representing alphabetic sorting of 1 large dataset. wish change size of select if there not enough elements code not responding well. if click on button loads more 1 element change size once , stay @ size.

function afteralphabetclick() {     if (document.getelementbyid("datacalls/data/indicator").options.length > 1) {         document.getelementbyid("datacalls/data/indicator").style.height = "400px;"      } else {         document.getelementbyid("datacalls/data/indicator").style.height = "25px";     } } 

you should using

    document.getelementbyid("datacalls/data/indicator").length  

in condition rather than

    document.getelementbyid("datacalls/data/indicator").options.length 

if html select has id of "datacalls/data/indicator"


Comments