Self invoking function defined inside jQuery event is not working, but why?
$('div').on('click', function(){
$('div').text($('div').text() + 1)
(function(){
$('div').text($('div').text() + 0)
})();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>text</div>
Edit:
Answers below are focused on this
keyword so I've changed this
parameter to 'div'
. It still does not work.