[英]Why can't I get my javascript to hide box unless ticked in Sharepoint with Knockout?
它本身可以在頁面的下方繼續工作,但是當我將它放在表的div中時,它將無法工作。
選中該復選框將顯示日期選擇器,但除非下拉菜單中的選項為
我的代碼:
JavaScript的:
<script type="text/javascript">
$(document).ready(function(){
$('input[type=checkbox]').change(function(){
var checked = this.checked;
if (checked) {
$('.other').show();
} else {
$('.other').hide();
}
});
});
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
ASP頁面:
<td data-bind="visible: checkBool" style="width: 278px">
<input type="checkbox" id="endDateCheck"/>
Tick this box if there is an end date for the
permissions.
<div class='other' name='other' title='other' style='display:none;'>
<p>Date: <input type="text" id="datepicker"/></p>
</div>
</td>
當前,無論是否選中復選框,稱為“其他”的div始終處於隱藏狀態。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.