javascriptjquerybuttoncleditor

cleditor pressing and disabling button with js


I'm trying to press and disable one of cleditor buttons in one of my textarea fields from jquery. Particullary "Show Source". I was trying to do get to button with something like this:

$(document).ready(function () {
    $('.textareaclass').cleditor.buttons.source.title = "Source";
});

But it says

Uncaught TypeError: Cannot read property 'source' of undefined

Any suggestions?


Solution

  • The simplest way to personnalize the toolbar is passing parameter at the widget creation :

    $("#input").cleditor({controls:"bold italic underline strikethrough subscript superscript | font size"});
    

    Also, make sure not to confuse $("#input").cleditor(); and $.cleditor :

    The first transform an element (here #input) into a cleditor. Inside parenthesis, you can add parameters. The second is a global object which carry global and more tricky parameters (add callbacks for example).