I have a dropdown list and I'm passing the value to a function which performs a task when the value changes.
<li style="background-color:white; float:right">
  <select id="dpItems" onchange='loadScript();'>
    <option value="">Select</option>
    <option value="5">5</option>
    <option value="10">10</option>
    <option value="20">20</option>
    <option value="50">50</option> 
  </select> items per page
</li>
And the javascript that is getting the value as follows:
function loadScript() {
  var newItems = parseInt($("#dpItems").val());
  alert('New value: ' + newItems);
  console.log('New value: ' + newItems);
}
But I'm always getting NaN value instead of the correct value on the option within the select. I tried changing the value on the option to 5 (without quotes) but same result.
Any ideas? Thanks in advance for any help.
 
     
    