How to get the selected value of a dropdown item using jQuery?

Method 1:

let selectedValue = $('#element_id option:selected').val();

Example:

var roleId = $('#ddlRole option:selected').val();
alert('Selected Role Id is: ' + roleId);

Method 2:

let selectedValue = $('#element_id').val();

Example:

var roleId = $('#ddlRole').val();
alert('Selected Role Id is: ' + roleId);

Output:

 

Demo: https://jsbin.com/kakaxazudo/1/edit?html,output