I just don't get it.
function init() {
$(document).on('click', '#listFilter .option:not(".darr"), #listSort .option:not(".darr")', function() {
var selected = $(this).data('ajax-link'),
dropDown = $(this).parent().parent(),
filter = '',
sort = '';
if ( dropDown.attr('id') == "weaveListFilter" ) {
filter = selected;
sort = $('#listSort .darr').data('ajax-link');
} else if ( dropDown.attr('id') == "weaveListSort" ) {
filter = $('#listFilter .darr').data('ajax-link');
sort = selected;
}
if ( selected != dropDown.find('.darr').data('ajax-link') )
console.log('why?')
sortList(filter, sort, dropDown.parent());
//console.log('wtf!')
});
}
Without the console.log('why?') the sortList() function is not called!!!
Why does it not get called without this line?
The weirdest thing is, that this "why?" is not even logged in my console. But without it the sortList() function doesn't execute. The "wtf!" after the function-call would be logged but I don't get it anyway.
Ideas? Am I dumb or so?
selected != dropDown.find('.darr').data('ajax-link')is never true. If nothing gets logged, thenconsole.log('why?')is never executed, either. Try surrounding theconsole.logcall andsortListwith{and}.