1

My Question:

I trigger a click event one time for every checkbox, now i want to add in special case a function to this click event.

jQuery(document).on("init.checkbox", function(){
    jQuery('.checkbox').each(function($index){

        jQuery(this).click(function(){
                    bla bla
        });
    });
});

Now i want to add for same and more classes a click event that just fired one time. If i do this :

jQuery(document).on("click.checkbox.label", function() {
    jQuery('.radio, .label_radio, .checkbox, .label').each(function () {
        jQuery(this).bind('click', function (event) {

            console.log('event fired');
            loadDetailHeight();
        });
    });

});

i got evey time i click a new event in so it stacks.

Example:

12:30 : event fired
12:31 : event fired
12:31 : event fired
12:32 : event fired
12:32 : event fired
12:32 : event fired

It stacks every time one more. How can i reach that the event just add one time?... :(

Thx 4 Help

0

1 Answer 1

1

use stopPropagation, it prevents further propagation of the event :

jQuery(this).bind('click', function (event) {
    event.stopPropagation();
    console.log('event fired');
    loadDetailHeight();
});
Sign up to request clarification or add additional context in comments.

1 Comment

Thx i tried it, but it dont work. And now it works perfekt ... sry for this question -.-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.