这是我用来将 div 添加到页面的 jQuery 代码。
var div = jQuery(document.createElement('div'));
div.attr('id', 'divFormWrapper');
div.css({
"position": "absolute",
"top": 0,
"left": 0,
"width": "100%",
"height": "100%",
"overflow": "auto",
"-webkit-overflow-scrolling": "touch",
"background-color": "orange",
"border": "none",
"z-index": 0,
"display": "block"
});
jQuery('form').wrap(div);
它在表单标签之前添加了 div 标签。我需要它在表单标签之后添加 div 标签。
<div id="divFormWrapper" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; overflow-x: auto; overflow-y: auto; background-color: red; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; z-index: 0; display: block; ">
<form name="Form1" method="post" id="Form1">
controls.......
</form>
</div>
这就是我需要它做的。
<form name="Form1" method="post" id="Form1">
<div id="divFormWrapper" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; overflow-x: auto; overflow-y: auto; background-color: red; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; z-index: 0; display: block; ">
controls.......
</div>
</form>