Writing if/else statements in the middle of jQuery code doesn’t feel right:
if ($("#test").length) {
// do smth
}
else {
// do smth else
}
Is there something similar to:
$("#test").test(function(){
// do smth
},
function(){
// do smth else
});
There is, now!
Working demo at http://jsfiddle.net/alnitak/n2CLZ/