Display selected Select value

1

I have this dropdownlist:

 <select>
                <option value="0">Selecione os capitulos</option>
                @foreach (var item in ViewBag.Capitulos)
                {
                    <option value="@item.IdCapitulo">@item.TituloCap</option>
                }

            </select>

How do I display the chosen value on the same page? I want the user when choosing the chapter, automatically load the user's choice into a textarea below. Is it possible to do this?

    
asked by anonymous 23.11.2014 / 03:14

1 answer

1

I made this example using jQuery:

$(document).ready(function(){
  $('.capitulos').on('change', function(){
     $('.escolhido').text($(this).val());
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select class='capitulos'>
   <option value=''>Selecione...</option>
   <option value='1'>Capítulo 1</option>
   <option value='2'>Capítulo 2</option>   
</select>

<textarea class='escolhido'></textarea>
    
23.11.2014 / 08:27