w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Get value from the user selected option on select option element and update the input form based on chosen option

You'll need to get the value of the selected option inside your handler, otherwise the variable won't be updated with the current value. Also, jQuery selectors are case sensitive, so you'll need to use #Reason not #reason.

This should work for you:

$('#Reason').on('change', function(){
    var selectedOption = $(this).find("option:selected").text();

Working Demo

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.