ブログ投稿のレイアウトに影響を与えるこれらの奇妙なdivを生成しているrssウィジェットがあります。これらのdivは、画像と画像の1つの段落だけを囲み、画像を折り返す必要がある他の段落を押して、本当に厄介なスペースのブロックを作成します。
既存のマークアップの例を次に示します。
<div class="separator" style="clear: both; text-align: left;">
<a style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" imageanchor="1" href="#" target="_blank">
<img width="320" height="214" border="0" src="http://3.bp.blogspot.com/-TIpzIZpEY50/TwEruI4XDlI/AAAAAAAAAXg/gIv3vafB3Sc/s320/December+2011+130.JPG">
</a>
and here is a bunch of text
</div>
私がやりたいのは、ラッピングdivクラスセパレーターを削除し、その中のコンテンツに置き換えることです。このdivの各インスタンスには、異なるコンテンツがあります。
だから私は次のjqueryスクリプトを使おうとしましたが、コンテンツが子divでラップされていないため、機能しません。
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div.separator").replaceWith(function() {
return $(this).contents();
});
ご協力いただきありがとうございます!