显示从模态到范围的选择输入的数据



如何显示从模态到模态外范围的选定输入的值?这是我到目前为止得到的:这是我的模态:

#date.modal.inmodal.fade(tabindex='-1' role='dialog' aria-hidden='true')
.modal-dialog.modal-m
.modal-content
.modal-header
button.close(type='button' data-dismiss='modal')
span(aria-hidden='true') ×
span.sr-only Close
h4.modal-title Select reporting month
.modal-body
.form-group
h4
i.fa.fa-calendar
|  Month
.selectContainer
select.form-control(name='month')
option(value='') Choose a month
option(value='') January
option(value='') February
option(value='') March
option(value='') April
option(value='') May
option(value='') June
option(value='') July
option(value='') August
option(value='') September
option(value='') October
option(value='') November
option(value='') December
.form-group
h4
i.fa.fa-calendar
|  Year
.selectContainer
select.form-control(name='year')
option(value='') Choose a year
option(value='') 2017
option(value='') 2018
.modal-footer
button.btn.btn-white(type='button' data-dismiss='modal') Close
button.btn.btn-primary(type='button') Save

这是我需要显示它们值的跨度

h3
strong
em CCP Manual testing metrics report 
br
span <--- THE SPAN WHERE I NEED THE VALUE OF THE MONTH -->
em

将类分配给span,例如display。这样可以更轻松地在文档中找到它。以下是从下拉列表中读取内容并在跨度中显示它们的方法:

const month = $("select.form-control[name='month']").val();
const year = $("select.form-control[name='year']").val();
$('span.display').text(`Month: ${month}, Year: ${year}`);

最新更新