jquery-end

jQuery's .end() doesn't work as expected after .contents()?

偶尔善良 提交于 2020-01-16 18:02:21
问题 a = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").remove().end().text() b = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").text() c = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").empty().end().text() d = $("table").clone().text() $("#a").text(a) $("#b").text(b) $("#c").text(c) $("#d").text(d) <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

jQuery's .end() doesn't work as expected after .contents()?

早过忘川 提交于 2020-01-16 18:01:25
问题 a = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").remove().end().text() b = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").text() c = $("table").clone().find("p:has(input)").contents().not("span:has(input:checked)").empty().end().text() d = $("table").clone().text() $("#a").text(a) $("#b").text(b) $("#c").text(c) $("#d").text(d) <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>