selectedIndex is undefined javascript -


my select giving me undefined index.

my code:

html

<div name="daystoreorder" class="days_to_reorder" onchange="getreordertables(this)"> day reorder <br>               <select name="daystoreorder">               <option value="a">a</option>               <option value="b">b</option>               <option value="c">c</option>               <option value="d">d</option>               <option value="e">e</option>               <option value="f">f</option>               </select></div> 

js

  function getreordertables(select)     {      alert(select.selectedindex);       } 

since onchange on <div>, this refers <div>. <div>s don't have selectedindex.

try applying event <select> instead.


Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -