On Select box change assign selectbox value to textbox
Confluence User - 24 May, 2021
Hi
im having hard time with assigning the value of a selectbox to a textbox.
my select box is called Progress, which have options Stage 1, stage 2 etc.
each stage has a value assigned stage 1 = 0, stage 2 = 10 so on.
and i would like to view the value on textbox called Completion so that use can see the progress numerically.
Also im trying to show the value in the text box when there is a selection made
i have tried this code,
<script type="text/javascript">
$('input[name="Progress"]).change( function(){
var e = document.getElementById("Progress");
var value=e.selectElement.options[e.selectedIndex].value;
$('input[name="Completion"]').val(value);
});
</script>
and this
<script type="text/javascript">
$(window).load(function(){
$(document).ready(function() {
$("#Progress option").filter(function() {
return $(this).val() == $("#Completion").val();
}).attr('selected', true);
$("#Progress").live("change", function() {
$("#Completion").val($(this).find("option:selected").attr("value"));
});
});
});
</script>
and various other scripts.
in the same form i have other custom html scripts that works for datetimepickers but this seems to not work for me
any help is really appreciated
Thank you
javascript;forms;selectbox