为什么引导程序不能在javascript中工作但在外面工作。
这是我的代码:
var date = new Date();
date.setDate(date.getDate());
$('.datepicker').datepicker({
startDate: date,
autoclose: true,
format: "mm-dd-yyyy",
todayHighlight: true,
orientation: "top auto",
todayBtn: true,
todayHighlight: true,
});
var rowCount = 1;
function removeRow(removeNum) {
jQuery('#rowCount'+removeNum).remove();
rowCount --;
rcount();
}
function addMoreRows(frm) {
rowCount ++;
var recRow = '<p id="rowCount'+rowCount+'"><tr><td><input id="datepkr" class="form-control datepicker" style="width:60%; float:left;" name="" type="text"/></td><td><a style="float:left;" href="javascript:void(0);" onclick="removeRow('+rowCount+');"><i class="glyphicon glyphicon-remove" style="color:red;"></i></a></td></tr></p>';
jQuery('#addedRows').append(recRow);
if (rowCount>15){
$('#btnAdd').prop('disabled', true);
}
}
function rcount(){
if (rowCount==3){
jQuery('#x2').hide('slow');
jQuery('#x3').show('slow');
}
if (rowCount==4){
jQuery('#x3').hide('slow');
jQuery('#x4').show('slow');
}
if (rowCount==5){
jQuery('#x4').hide('slow');
jQuery('#x5').show('slow');
}
if (rowCount==6){
jQuery('#x5').hide('slow');
jQuery('#x6').show('slow');
}
if (rowCount==7){
jQuery('#x6').hide('slow');
jQuery('#x7').show('slow');
}
if (rowCount==8){
jQuery('#x7').hide('slow');
jQuery('#x8').show('slow');
}
if (rowCount==9){
jQuery('#x8').hide('slow');
jQuery('#x9').show('slow');
}
if (rowCount==10){
jQuery('#x9').hide('slow');
jQuery('#x10').show('slow');
}
if (rowCount==11){
jQuery('#x10').hide('slow');
jQuery('#x11').show('slow');
}
if (rowCount==12){
jQuery('#x11').hide('slow');
jQuery('#x12').show('slow');
}
if (rowCount==13){
jQuery('#x12').hide('slow');
jQuery('#x13').show('slow');
}
if (rowCount==14){
jQuery('#x13').hide('slow');
jQuery('#x14').show('slow');
}
if (rowCount==15){
jQuery('#x14').hide('slow');
jQuery('#x15').show('slow');
}
if (rowCount==16){
jQuery('#x15').hide('slow');
jQuery('#x16').show('slow');
}
if (rowCount>14){
$('#btnAdd').prop('disabled', true);
}
else{
$('#btnAdd').prop('disabled', false);
}
}
&#13;
<script src="https://code.jquery.com/jquery-3.1.0.js" integrity="sha256-slogkvB1K3VOkzAI8QITxV3VzpOnkeNVsKvtkYLMjfk=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/blogController.js"></script>
<table>
<tr id="rowId">
<td><input name="" type="text" value="" class="datepicker"/></td>
<td><button type="button" id="btnAdd" onclick="addMoreRows()" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i>ADD</button></td>
</table>
<div id="addedRows"></div>
</td>
</tr>
&#13;
Here it is Showing the Datepicker but in a javascript generated input its not showing
希望有人能提供帮助。谢谢。
答案 0 :(得分:1)
您需要更正JS代码。请尝试以下代码。
{
type: "button",
togglable: true,
id: "groupableToggle",
toggle: function (e) {
var grid = $("#grid" + config.id).data("kendoGrid");
if (e.checked) {
grid.options.groupable = {
messages: {
empty: "drag a column header and drop it here to group by that column"
}
};
}
else
grid.options.groupable = false
grid._thead();
grid.refresh();
}
}
您可以在此处查看演示:JSFIDDLE