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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -