itsjavi / bootstrap-colorpicker

Bootstrap Colorpicker is a modular color picker plugin for Bootstrap.
https://itsjavi.com/bootstrap-colorpicker/
MIT License
1.38k stars 367 forks source link

Initialize by class selector #278

Closed MHarmony closed 6 years ago

MHarmony commented 6 years ago

Is there a way to initialize multiple colorpickers at once by class selector? I tried a few options, such as initializing colorpicker on a single class selector, as well as looping through each element with a class and initializing that element. No luck so far.

itsjavi commented 6 years ago

please provide an example like it was described in the issue template

ken-muturi commented 5 years ago

    <span class="letter" data-letter="A">A</span>
    <span class="letter" data-letter="B">B</span>
    <span class="letter" data-letter="C">C</span>
    <span class="letter" data-letter="D">D</span>
    <span class="letter" data-letter="E">E</span>
    <span class="letter" data-letter="F">F</span>

    $('span.letter').colorpicker().on('changeColor', function(event) {
    $('span.letter').css('color', event.color.toString());
    });