html:
<select name="setvalue" id="setvalue" data-id="3"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select>
<input type="hidden" value="3" id="selectval">
JS:
var selectval= document.getElementById("selectval").value; var selectid = document.getElementById("setvalue"); for(i=0;i<selectid.length;i++){ if(selectid[i].value==selectval) selectid[i].selected = true; }