對於某些特定情況,我想將標籤元素移到頂部。我的解決方案很簡單:嘗試在Safari上使用insertAfter移動標籤問題
$("label[for='option_3']").insertAfter("label[for='option_0");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<label for="option_0">
first item
</label>
<label for="option_1">
second item
</label>
<label for="option_2">
third item
</label>
<label for="option_3">
forth item
</label>
<label for="option_4">
fifth item
</label>
它的工作相當不錯的Firefox和Chrome,但它並沒有在Safari瀏覽器(版本10.0.1(12602.2.14.0.7))工作。
有什麼想法?
謝謝@Deep。 (Chrome和火狐工作,即使與錯誤,這欺騙了我) –
歡迎:) – Deep