.hasClass()라는 플러그인이 있다는 것을 알고 있습니다.jQuery check 요소 ID
내가 가지고있는 내가 page_background가 클릭하면 확인 header_background하지 않을 방법
$('#page_background, #header_background').ColorPicker({...
을 다음?
이것은 내가 지금 가지고있는 것입니다. 작동하지 않습니다. this
는 jQuery를 객체가 아닌 DOM 노드 인 경우 당신이 할 수있는,
var id = this.id;
:
$('#page_background, #header_background').ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
$(el).val(hex);
$(el).ColorPickerHide();
var id = this.id;
if(id == 'page_background')
$('body').css("background-color","#"+hex);
},
onBeforeShow: function() {
$(this).ColorPickerSetColor(this.value);
}
})
.bind('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
id
사용을 얻을 수 있습니다 id를 찾고'background_color' howe 당신은 그 id를 가진 요소에 click 이벤트를 바인딩하지 않습니다. (당신이 방금 다시 되돌려 준 편집을 바탕으로) –