JSFiddle - React, Tailwind, and code Playground
by andres_314
HTML
<div class='hello'></div>
JavaScript
//http://benalman.com/projects/jquery-iff-plugin/
$.fn.iff = function( test ) {
var elems = !test || $.isFunction( test )
&& !test.apply( this, Array.prototype.slice.call(arguments, 1) )
? []
: this;
return this.pushStack( elems, 'iff', test );
};
$.fn.logger = function(msg) {
console.log(msg)
return this;
};
function my_alert() {
return false;
};
$('.hello')
.append( 'hello' )
.iff( my_alert )
.append( ' world' ).logger('yeah');