を使用して下にHTML要素を移動します。 insertAfter()
またはafter()
を使用するか、この要件を満たすためにjQuery関数を使用すべきですか?は、私は以下のようにHTMLコードを持っているjQueryの
おかげ
を使用して下にHTML要素を移動します。 insertAfter()
またはafter()
を使用するか、この要件を満たすためにjQuery関数を使用すべきですか?は、私は以下のようにHTMLコードを持っているjQueryの
おかげ
appendToは、あなたは以下のコードを使用することができ、要素のDOM
$('#foo, #bar').appendTo('#wrap');
はい、あなたは.after()
を使用することができます。
$('#seven').after($('#foo, #bar'));
の末尾に要素を移動します:
$('#wrap').append('<div id="foo"></div>')
これは私が少しリード後、私はサイト全体で使用するには、もう少し一般的なものを必要な可能性が...スルーがベストです:TESTED
ブラウザ:クロム、Firefoxの、IE7、IE8、IE9
をOBJECTIVE ... "その他"を下に移動する...サーバーサイドのコードでマークアップを変更する方法がありませんでした。
<select name="anyName" id="anyID" >
<option value="Other">Other</option>
<option value="Entry 1" >Entry 1</option>
<option value="Entry 2" >Entry 2</option>
<option value="Entry 3" >Entry 3</option>
</select>
<script type="text/javascript">
$(document).ready(function() {
$("select option").each(function() {
if($(this).text() === "Other" && $(this).parent("select").children("option:last-child").text() !== "Other") {
$(this).insertAfter($(this).parent("select").children("option:last-child"));
}
});
});
</script>
私はDOMとjavascriptの使用がうまくいくと思います。結局、jQueryはそれを使用します。 – Rob