如果单选按钮“是”'检查我需要返回日期选择功能。我该怎么做
单选按钮
<br><label for="return_journey">would you like a return journey?</label><br>
<input type="radio" name="return" value="yes">Yes
<br>
<input type="radio" name="return" value="no">No
</form><br><br>
日期选择器
$(function () {
$('#datetimepicker6').datetimepicker();
$('#datetimepicker6').datetimepicker();
$("#datetimepicker6").on("dp.change",function (e) {
$('#datetimepicker6').data("DateTimePicker").minDate(e.date);
});
$("#datetimepicker6").on("dp.change",function (e) {
$('#datetimepicker6').data("DateTimePicker").maxDate(e.date);
});
});
答案 0 :(得分:1)
将更改事件附加到您的输入并找出已选择的事件。你可以这样做:
$('input[name=return]').on('change', function() {
if($(this).val() == "yes" && $(this).is(":checked")) {
// CODE GOES HERE
}
});