if ($(this).closest(".dateinput").attr('disabled','disabled').length) {
if ($(this).closest(".dateinput[disabled]").length) {
if ($(this).closest(".dateinput").is("[disabled=disabled]")) {
if ($(this).closest(".dateinput").find("disabled").length) {
if ($(this).closest(".dateinput").prop('disabled', 'disabled'))
if ($(this).closest(".dateinput").is(':disabled'))
I’m not sure about jQuery, so I don’t know if this helps at all, but in vanilla JS, you would disable/enable an element by setting element.disabled = true or false.
Hi gandalf458, ye I could do that, but what Im finding is that to allow me to do this my if this .closest is not identifying if the input has disabled=“disabled” set.
Clicking on DP2’s icon will find a match for $(this).prev(".datepicker[disabled='disabled']") - because DP 1 is still a sibling of that span.
You might want to use the slightly longer $(this).prev(".datepicker").filter("[disabled='disabled']"), which avoids this possibility by selecting the first datepicker before the span, and THEN testing to see if it’s disabled, if you want to put multiple in a single container.
Im just thinking about it now, there want be an instance where 2 next to each other will have different disabled values, as the user within that form will either have the option to edit or not, so hopefully then with that will .prev cover them both, as long as the developer has built it right, to allow for this.