mercredi 27 juillet 2016

html change text based on input field

I have an <h3> that I want the value of to change based on what is typed in the input field. Here is the code I currently have:

<input id="Medication" name="Medication" size="50" type="text" value="">
<script>
$(document).ready(function () {
  $('#Medication').change(function () {
    $('#myAnchor').text($(this).val());
  });
});
</script>
<h3 id="myAnchor"></h3>

Aucun commentaire:

Enregistrer un commentaire