JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test1">test 1</div>
<div id="test2">test 2</div>
JavaScript
$.fn.tester = function() {
this.css = function() {
console.log(this.selector); // This one logs the selector
return this;
}
this.html = function() {
alert(this.selector); // This one alerts the selector
return this;
}
return this;
};
// Because .css() is called after .tester(),
// it should now log the selector instead of the normal behavior
// and still fade properly
$('#test1').tester().css().html().animate({opacity:.3});
// .css() still behaves normally for this one
// that doesn't use the plugin
$('#test2').css('backgroundColor','blue').html('new value');