tkrotoff / jquery-simplecolorpicker

Very simple jQuery color picker
http://plnkr.co/edit/VVclW0?p=preview
MIT License
386 stars 87 forks source link

Click on background (not a color) of the picker fires a change event #16

Closed WhetDawg closed 11 years ago

WhetDawg commented 11 years ago

Ciicking on the Picker background span instead of Color Button span is firing a change event. Need to check if it is a button that was clicked.

    click: function (e) {
        alert('here');
        var target = $(e.target);
        if (target.length === 1) {
            if (target[0].nodeName.toLowerCase() === 'span') {
                if (target.attr('role') == 'button') {               // FIXES
                    // When you click on a color, make it the new selected one
                    this.selectColorSpan(target);
                    this.$select.trigger('change');
                }
            }
        }
    },
tkrotoff commented 11 years ago

Thanks for the bug report, fixed in commit a6f001bfa3