First of all, the onchange
event is for the select
element, not the option
elements. Those don't actually change. Also, you have two JavaScript functions. showUser()
and copy()
. But you describe only one piece of functionality. What do these two functions do?
As for showing the text in the label, here's one way to do it (using jQuery, because everybody does):
$(document).ready(function() {
$('#users').change(function() {
$('#myLabel').text($(this).val());
});
});
What this is basically doing is:
change
event of the specified select
element.select
.