首页 > 代码库 > JS-日期框、下拉框、全选复选框

JS-日期框、下拉框、全选复选框

<!-- 下拉框 -->
<link rel="stylesheet" href="http://www.mamicode.com/static/ace/css/chosen.css" />

<!-- 日期框 -->
<link rel="stylesheet" href="http://www.mamicode.com/static/ace/css/datepicker.css" />

<!-- 日期框 -->
<script src="http://www.mamicode.com/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<!--提示框-->
<script type="text/javascript" src="http://www.mamicode.com/static/js/jquery.tips.js"></script>

 


$(function() { //日期框 $(‘.date-picker‘).datepicker({ autoclose: true, todayHighlight: true }); //下拉框 if(!ace.vars[‘touch‘]) { $(‘.chosen-select‘).chosen({allow_single_deselect:true}); $(window) .off(‘resize.chosen‘) .on(‘resize.chosen‘, function() { $(‘.chosen-select‘).each(function() { var $this = $(this); $this.next().css({‘width‘: $this.parent().width()}); }); }).trigger(‘resize.chosen‘); $(document).on(‘settings.ace.chosen‘, function(e, event_name, event_val) { if(event_name != ‘sidebar_collapsed‘) return; $(‘.chosen-select‘).each(function() { var $this = $(this); $this.next().css({‘width‘: $this.parent().width()}); }); }); $(‘#chosen-multiple-style .btn‘).on(‘click‘, function(e){ var target = $(this).find(‘input[type=radio]‘); var which = parseInt(target.val()); if(which == 2) $(‘#form-field-select-4‘).addClass(‘tag-input-style‘); else $(‘#form-field-select-4‘).removeClass(‘tag-input-style‘); }); } //复选框全选控制 var active_class = ‘active‘; $(‘#simple-table > thead > tr > th input[type=checkbox]‘).eq(0).on(‘click‘, function(){ var th_checked = this.checked;//checkbox inside "TH" table header $(this).closest(‘table‘).find(‘tbody > tr‘).each(function(){ var row = this; if(th_checked) $(row).addClass(active_class).find(‘input[type=checkbox]‘).eq(0).prop(‘checked‘, true); else $(row).removeClass(active_class).find(‘input[type=checkbox]‘).eq(0).prop(‘checked‘, false); }); }); });

 18271929370这个百度云中有下载

http://pan.baidu.com/s/1nuVEPVb

JS-日期框、下拉框、全选复选框