Chcę tylko zaznaczyć elementy, które pasują do klasy X i nie mają żadnychrodzeństwo, które również posiadają klasę X. W moim przypadku, X = hasDatepicker
. Oto co mam wymyślić:jQuery: Wybierz elementy klasy X, które nie mają rodzeństwa z tej klasy
$('.hasDatepicker:not(.hasDatepicker ~ .hasDatepicker)')
Jednak nie wyklucza to pierwszy element, więc w każdej grupie datepickers, to będzie jeszcze wybrać pierwszy. Nie chcę włączać żadnych grup, tylko singli.
Przykład z Partner:
<div class="input text">
<input name="data[Goal][date_started]" type="text" value="" class="hasDatepicker" style="display: none; ">
<button type="button" class="ui-datepicker-trigger"><img src="/themed/mocha/images/btn_calendar.png" alt="..." title="..."></button>
</div>
Przykład z wyników:
<div class="input text">
<input type="text" value="" id="GoalDateStarted" class="hasDatepicker"><input type="text" value="" class="hasDatepicker" style="display: none; ">
<input type="text" value="" class="hasDatepicker" style="display: none; ">
<input name="data[Goal][date_started]" type="text" value="" class="hasDatepicker" style="display: none; ">
<button type="button" class="ui-datepicker-trigger"><img src="/themed/mocha/images/btn_calendar.png" alt="..." title="..."></button>
</div>
Jakieś pomysły? Dzięki!
Czy możesz podać przykład struktury HTML i jakie elementy chcesz dopasować? –
@GaryGreen done :) – Garrett
Jaki element chcesz wybrać w oparciu o twój przykład, div rodzica lub dane wejściowe z klasą hasDatepicker? – j08691