0
다른 라디오 버튼을 선택할 때마다 업데이트 할 jquery 날짜 선택기를 가져 오려고합니다.jQuery DatePicker 라디오 버튼 선택에 따른 업데이트 옵션
<div style="padding-bottom: 50px;">
<label>Location: </label>
<input type="radio" name="locate" value="Internal">Internal
<input type="radio" name="locate" value="External">External
</div>
<div>
<label>Due Date: </label>
<input type="text" name="dueDate" id="dueDate" size="25" placeholder="Please Enter A Due Date" autocomplete="off" readonly="true">
</div>
jQuery는 작동하지만 새로운 라디오 버튼을 클릭 할 때마다 datePicker를 업데이트하지 않습니다.
var locate = null;
$("input[name='locate']").click(function() {
locate = this.value;
if (locate == "Internal") {
$("#dueDate").datepicker({ minDate: '-6M', maxDate: '+6M' });
alert("Internal");
} else {
$("#dueDate").datepicker({ minDate: -0, maxDate: '+6M' });
alert("External");
}
});
내가 언급 한 내용을 구현했으며 라디오 버튼을 변경할 때 날짜 선택 도구를 업데이트 할 때마다 여전히 업데이트되지 않습니다. 업데이트 할 때마다 페이지를 새로 고쳐야합니다. – pptaszek1990
@ pptaszek1990 좋아, 전체 코드와 데모 페이지 링크로 내 대답을 편집했습니다. –
굉장! 잘 했어! 도와 줘서 고마워! – pptaszek1990