0

I have this jquery code below and I need it to attach events on controls as the controls are created dynamically.

Right now they are set for a specific control.

Thanks

$(document).on("click", "#day1Header", function () {
        $("#day1Details").slideToggle("normal");
        $(".expandDay1Details").html($(".expandDay1Details").html() == 'CLOSE' ? 'EDIT' : 'CLOSE');
    });

    $(document).on("click", "#day2Header", function () {
        $("#day2Details").slideToggle("normal");
        $(".expandDay2Details").html($(".expandDay2Details").html() == 'CLOSE' ? 'EDIT' : 'CLOSE');
    });

    $(document).on("click", "#day3Header", function () {
        $("#day3Details").slideToggle("normal");
        $(".expandDay3Details").html($(".expandDay3Details").html() == 'CLOSE' ? 'EDIT' : 'CLOSE');
    });

Edited by pyTony: Moved to proper Javascript forum

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by jwdunne
0

May I see an example of the HTML that this is code is used on? This will help me provide a good answer.

0

It would ve also more proper to state what legacy language you are dealing with.

Edited by pyTony

0

@pyTony this is Javascript using the jQuery framework so not exactly legacy and probably not the best place for this.

--> MOVED to JavaScript forum from Legacy Languages (pyTony)

Edited by pyTony: Thread moved announcement

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.