locked
Initialize controls in AccordionPane RRS feed

  • Question

  • User1453632690 posted

    I have an Accordion with 3 AccordionPanes. Each AccordionPane has several controls used to perform some logic. The Accordion is in a TabPanel. I want to be able to:

    1. Reset or initialize the controls in each AccordionPane when the TabPanel is entered (or exited).

    2. Prevent the user from selecting another AccordionPane while work is being done in the current AccordionPane, or at least warn the user that changing panes will reset all controls in the Pane being left.

    3. Reset or initialize controls in each AccordionPane when entering or exiting one of the AccordionPanes.

    All this preferably with as little javaScript as possible - preferably none.

    Thank you

    Wednesday, December 9, 2015 6:17 PM

Answers

  • User61956409 posted

    Hi jnickFL1,

    If you check the html markup using F12 developer tools, you will find the Accordion will be rendered as

    You could find content div and reset controls in header click event.

    $(function () {
        $(".accordionHeader").click(function () {
            //use $(this).next("div") to find the content div
            //then you could find controls(elements) from the content div
            //and reset or initialize the controls 
        })
    })
    

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 10, 2015 7:49 AM