JSFiddle - React, Tailwind, and code Playground
by JM note
HTML
<script src="//code.jquery.com/jquery.min.js"></script>
<script>
// 플러그인
(function ( $ ) {
$.fn.redify = function() {
this.css( "color", "red" );
return this;
};
}( jQuery ));
(function ( $ ) {
$.fn.showCount = function() {
return this.each(function() {
$(this).append( ' (' + $(this).data('count')+'개)' );
});
};
}( jQuery ));
// 사용 예시
$(function() {
$('#fruits>li').showCount().redify();
});
</script>
<ul id='fruits'>
<li data-count='3'>사과</li>
<li data-count='5'>배</li>
</ul>