datepicker没有进入新的选项卡 [英] datepicker not working into new tabs
本文介绍了datepicker没有进入新的选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我点击。 Datepicker不适用于新的选项卡
这是代码
When I click. Datepicker not working into new tabs
This is code
<script>
var tabCounter = 2,
tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>";
var tabs = $( "#tabs" ).tabs();
var tabContentHtml = $("#tabs-1").html();
创建日期戳。进入tab1。无法进入tab2
Create datepicker. Work into tab1. Not work into tab2
$( ".rush" ).datepicker();
点击按钮时添加新标签
$("#add_tab").click(function(){
addTab();
});
function addTab() {
var label = "Tab " + tabCounter,
id = "tabs-" + tabCounter,
li = $( tabTemplate.replace( /#\{href\}/g, "#" + id ).replace( /#\{label\}/g, label ) );
tabs.find( ".ui-tabs-nav" ).append( li );
tabs.append( "<div id='" + id + "'><p>" + tabContentHtml + "</p></div>" );
tabs.tabs( "refresh" );
tabCounter++;
}
</script>
代码html
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a> <span class="ui-icon ui-icon-close">Remove Tab</span></li>
</ul>
<div id="tabs-1">
<input type="text" class="rush" />
</div>
</div>
<button id="add_tab">Add Tab</button>
推荐答案
它不工作的原因是因为datepicker的东西在页面加载完成当您添加新标签时,日期戳未被创建,请查看上一篇文章:
The reason it's not working is because the datepicker stuff is done when the page is loaded. When you add a new tab, the datepicker is not being created, have a look at the previous post:
这篇关于datepicker没有进入新的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文