L A

L A

  • NA
  • 170
  • 168.4k

Type of parameter for called function

Jun 4 2018 1:32 PM
Hi,
I'm working of webform which have multiple html controls.
 
html
  1. <div>  
  2.   <label for="ddlJobType">Job Category</label>  
  3.   <select id="ddlJobCategory" class="form-control" onchange="getselectedVal(this);"></select>  
  4.   <label for="ddlJobType">Job Type</label>  
  5.   <select id="ddlJobType" class="form-control" onchange="getselectedVal(this);"></select>  
  6. </div>  
What parameter should be send to the called function? is parameter 'this' an efficient way?
 
jQuery 
  1. function getselectedVal(**what should be the argument type**){  
  2.   alert('dropdown option:selected').val();  
  3. }  
I want to use the same function to give details of selected dropdown value. What should be the parameter type to access the selected html control.

Answers (3)