1
function opchk() {
    var val = document.getElementById("ops").value;
    document.getElementById("f9").innerHTML = val;
}

this will print out op1 or op2... i dont want to change the values of them and print the showing text, is that possible?

<select style="width:90px" id="ops" onblur="opchk()">
   <option value="op1">Select size</option>
   <option value="op2">5</option>
   <option value="op3">10</option>
   <option value="op4">15</option>
   <option value="op5">20</option>
</select>
T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
hannon qaoud
  • 79
  • 1
  • 12
  • @Syed - I'm an idiot. Of **course** there's a dupetarget for this! Thanks. – T.J. Crowder Jan 22 '20 at 09:45
  • 1
    @ hannon - See the linked question's answers for how to do this. Side note: I'd use modern event handling (`addEventListener`) and `input`, rather than `onblur`. I'd also probably have a blank `value` for the "Select size" option and show a blank string or something when it's selected: https://jsfiddle.net/tjcrowder/zknb03sy/ – T.J. Crowder Jan 22 '20 at 09:51

0 Answers0