【问题标题】:Javascript - create Element <hr> with inline style [duplicate]Javascript - 使用内联样式创建元素 <hr> [重复]
【发布时间】:2015-02-02 14:59:35
【问题描述】:

我想修改ckeditor的horizo​​ntalrule插件:

...
exec: function( editor ) {
        var hr = editor.document.createElement( 'hr' );
        editor.insertElement( hr );
    },

    allowedContent: 'hr',
    requiredContent: 'hr'
};
...

这个插件生成:

<hr />

但我想获得 sg。喜欢:

<hr style="color:#FFF; height:2px;" />

谁能帮我解决这个问题?

【问题讨论】:

    标签: javascript css function ckeditor


    【解决方案1】:
    hr.style.color = "#FFF";
    hr.style.height = "2px";
    

    您几乎可以随时对hr 变量执行此操作。

    【讨论】:

    • 我已经试过了,但它不起作用。这似乎是 ckeditor 的一个特定问题
    猜你喜欢
    • 2011-06-21
    • 2011-07-04
    • 2021-08-11
    • 1970-01-01
    • 2012-10-21
    • 1970-01-01
    • 2017-01-26
    • 1970-01-01
    相关资源
    最近更新 更多