単一のボタンを介して、jquery を使用して css リンクを切り替えたい。
キャッチは、iframeのターゲットでやりたいです。
これまでのところ、リンクをうまく挿入する次のコードがあります。
$("#custom").click(function() {
$("#content").contents().find("head").prepend("<link href=\"../build/css/custom.css\" rel=\"stylesheet\" id=\"custom-css\">");
});
これは、次の html によってアクティブ化されます。
<div class="toggle-custom">
<a target="custom" id="custom" class="btn btn-primary btn-lg">Toggle custom style</a>
</div>
<iframe id="content" src="carousel.html" frameborder="0" scrolling="auto">
</iframe>
それを削除する方法は次のとおりです。
$("#content").contents().find("#custom-css").remove();
しかし、どうすれば同じボタンから切り替えることができますか?
ありがとう