Indian Web Developer
Indian Web Developer

Reputation: 41

progressive disclosure - jquery - element by element

I have an requirement to develop a progressive disclosure using JQuery.

When the screen loads all the elements would be disabled. When the user fills up one element the next element should be enabled. It should happen sequentially.

The problem happens when the user clicks on some html input elements like radio button we have a section/div refresh and by default all the elements in the div get enabled as they have been refreshed.

My requirement is not to add any code to the control but to have event listeners globally and a callback that would be trigger whenever there is a partial screen refresh(div refreshes using ajax call).

Fiddle

function executeProgressiveDisclosure(elementIndex) {
    var nextElementIndex = Number(elementIndex) + 1;
    if (checkIfEndOfSelection(elementIndex)) return;
    $("#mydiv input, "
        # mydiv select ").eq(nextElementIndex).prop('disabled', false).focus();
      returnNextElement(nextElementIndex); // activate next element if same type
}

Upvotes: 1

Views: 493

Answers (0)

Related Questions