I’ve got this JS code, in the same shown order:
function init(){
//Initialize stuff
$('#specificUl > li').click();
//...
}
//Click event handler
function clickHandler(){
//Do some other stuff
//...
}
$(document).ready(function(){
init();
//Click event handler defined
$('li').click(clickHandler);
//...
});
Since click handler is defined on ready event I guess the calling of click event in init function is not going to work which is what’s already happening but I’m not sure. How should I reorganize the code to make it work?
switch click handler with init