jQuery.BlackAndWhite
jQuery.BlackAndWhite copied to clipboard
Put a check if wrapper is blank.
In case the wrapper has no image tag, it was generating error and halting the rest of execution, with this patch it will by pass such blank wrapper.
I think this should be enough:
if (!$img.length) return;
well $img was coming as undefined
so it will again generate the undefined error with that statement.
$img can never be undefined it's a jquery selector instance that is always an array. Sure your problem is not somewhere else? Could you make a jsfiddle please?
Why dont use:
$('.bwWrapper img').parent().BlackAndWhite...
?