in Education by
I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery) on Karl Swedberg's blog, and I became totally puzzled at this part of the code (simplified for brevity): function addItemUnbind() { $Add a button but it won't have it's event added; addItemUnbind(); }); Why is it that by putting the same function within itself it doesn't keep executing into an infinite loop? However, it is used to re-bind the event to the element...!? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
As far as i can tell your example will. However your example is not the same as the example on the website you reference. function addItemUnbind() { $('#list6 li.special button') .unbind('click') .bind('click', function() { var $newLi = $('special and new '); $(this).parent().after($newLi); addItemUnbind(); }); } In this example the 'addItemUnbind' is called when the user clicks on the button.

Related questions

0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 8, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 8, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 6, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 9, 2022 in Education by JackTerrance
0 votes
    First of all, thats my current state of play: thsbrk.de. The black boxes should be e.g. a about ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    When new SaveModelAction() is called, the corresponding Effect gets stuck in an infinite loop. This the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    When new SaveModelAction() is called, the corresponding Effect gets stuck in an infinite loop. This the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    I have to make this an infinite loop and also make it go back to the start when a wrong character ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
+1 vote
    What is an infinite loop in C-Programming?...
asked Nov 9, 2020 by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I want to get this format : 2019-03-24 15:05:20 Here is what I have tried: var today = ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
...