CKEDITOR 3.4.2中 按钮事件中 动态改变图标和title 获取按钮
this.uiItems[0].className="cke_button_hui_position_type";
this.uiItems[0].title="zhang";
//上面2中只是获取,修改后不管用
this.uiItems[0]._.id //获取ID
//只能通过jquery,找到id或classname来找到,然后修改
$("#cke_18")[0].title
完整代码:
editor.addCommand('sunyard_position_type',{ exec:function(editor){ CKEDITOR.positionType = CKEDITOR.positionType=='absolute'?'static':'absolute'; //动态设置图标title和lable $("." + this.uiItems[0].className)[0].label= lang[CKEDITOR.positionType]; $("." + this.uiItems[0].className)[0].title= lang[CKEDITOR.positionType]; //改变图标 //alert(editor.plugins.sunyard_position_type.path); if(CKEDITOR.positionType=="absolute") { $("."+this.uiItems[0].className)[0].children[0].style.backgroundImage="url("+editor.plugins.sunyard_position_type.path+ "icons/sunyard_position_type_absolute.gif"+")"; }else{ $("."+this.uiItems[0].className)[0].children[0].style.backgroundImage="url("+editor.plugins.sunyard_position_type.path+ "icons/sunyard_position_type_static.gif"+")"; } } });