Fred J. Fred J. - 6 months ago 27
jQuery Question

exclude elements from serializedArray

How can I get

.serializeArray
being applied of the
form
element to exclude elements with a given class? The following failed to ignore the
input
elements with class
inactive
. Thanks

$("form:not('.inactive>input')").serializeArray();


.inactive {
pointer-events: none;
opacity: 0.3;
}

Answer

Kind of a disgusting answer but an answer none the less.
Not really sure how your selector works.

    $("form .inactive>input").attr("disabled", "true");
    $("form").serializeArray();
    $("form .inactive>input").attr("disabled", "false");

Should work.