JSFiddle - React, Tailwind, and code Playground
by JM note
HTML
<script src="//code.jquery.com/jquery.min.js"></script>
<script>
// 플러그인
(function ( $ ) {
$.fn.highlight = function( options ) {
var opts = $.extend( {}, $.fn.highlight.defaults, options );
return this.css({
color: opts.color,
backgroundColor: opts.backgroundColor
});
};
$.fn.highlight.defaults = {
color: "red",
backgroundColor: "yellow"
};
}( jQuery ));
// 사용자 커스터마이징
$.fn.highlight.defaults.color = "skyblue";
// 사용 예시
$(function() {
$('.box1').highlight();
$('.box2').highlight({
backgroundColor: 'white'
});
$('.box3').highlight({
color: 'yellow',
backgroundColor: 'green'
});
});
</script>
<div class='box1'>한놈</div>
<div class='box2'>두시기</div>
<div class='box3'>석삼</div>