javascript - Colorpicker mjolnic.com custom element color change -
i'm using plugin:
http://mjolnic.com/bootstrap-colorpicker/
the example below shows how change body background color. how can work custom element/class instead of body?
my custom element work with:
<div class="strikethrough"></div>
body, working example demo:
<script> $( document ).ready(function() { var bodystyle = $('body')[0].style; $('.my-colorpicker').colorpicker().on('changecolor.colorpicker', function(event){ bodystyle.backgroundcolor = event.color.tohex(); }); }); </script>
you can select custom element's style using class selector this
var customeelementstyle = $('.strikethrough')[0].style;
Comments
Post a Comment