在jquery mobile中,我尝试用一些按钮替换我的标题。我使用jquery的html()函数来完成它。jquery html();无按钮样式
的问题是从按钮的图标会丢失,而且看起来不像原来的div ..
我怎样才能解决呢? Fiddle
HTML:
<div data-role="page" id="index">
<div id="header" data-theme="b" data-role="header">
<h1>replace this with some buttons</h1>
</div>
<div data-role="content">
<div id="map"></div>
</div>
</div>
<!-- div to instert-->
<span id="downBut"><center>
<button type="submit" id="down" style="width: 110px" data-mini="true" data-theme="a" data-transition="pop" data-icon="carat-d">Download</button>
<button type="submit" id="down" style="width: 110px" data-mini="true" data-theme="a" data-transition="pop" data-icon="delete">cancel</button>
</center></span>
的Javascript:
// make the from header buttons
$("#header").html($("#downBut"));
的CSS:
.ui-header {
height: 40px;
}
.ui-content {
position: absolute;
top: 40px;
right: 0;
bottom: 0;
left: 0;
padding: 0 !important;
margin: 0;
}
h1 {
margin: 0 auto;
}
你有相同的id'down'和不相同的造型两个按钮。将它更改为每个按钮的不同ID,或者改为给它们分类。 – urbz