Switch divs off/on

Once a div is offed can it be onned?

FIRST,

        $("#num-one").off();
        $("#num-two").off();
        $("#num-three").off();

THEN LATER ON,

        $("#num-one").on();
        $("#num-two").on();
        $("#num-three").on();

Because the divs are no longer responding to click events in spite of onning them - can they be onned once they are turned off?

Answers:

Answer

You have to bind it again with parameters, "telling" them which event you want to bind and what element on which you want to bind the event.

$("#num-one").on('click', function(){
});

You an make a function and bind all events in it and call it when you want to bind.

function bindMyEvents()
{

    $("#num-one").on('click', function(){
    });

    $("#num-two").on('click', function(){
    });

    $("#num-three").on('click', function(){
    });

}

bindMyEvents(); // to bind the events with single call

or

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.