如何为一个元素获取样式并将其放入另一个元素中?我的目标是摆脱包装器和 .ui-resizable-handlers 并只留下 img,但用替换的样式形成包装器。可能吗?
<div class="ui-wrapper ui-draggable" style="overflow: hidden; position: absolute; width: 492px; height: 411px; top: 105px; left: 409px; margin: 0px;">
<img id="link1" style="position: static; margin: 0px; resize: none; zoom: 1; display: block; height: 411px; width: 492px;" src="http://i.imgur.com/gKY7j0l.jpg" class="ui-resizable">
<div class="ui-resizable-handle ui-resizable-e" style="z-index: 90;">
</div><div class="ui-resizable-handle ui-resizable-s" style="z-index: 90;">
</div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90;">
</div>
</div>
所以在这个例子中,结果将是带有包装器样式的 img:
<img id="link1" style="overflow: hidden; position: absolute; width: 492px; height: 411px; top: 105px; left: 409px; margin: 0px;" src="http://i.imgur.com/gKY7j0l.jpg" class="ui-resizable">