Reputation: 76
How can I add a button to jwysiwyg that will add an HTML tag to the selected text? I tried this, based on the documentation:
$('#wysiwyg').wysiwyg({
controls: {
tt: { visible: true, tags: ['tt'], css: { class: 'tt', className: 'tt' } }
}
})
... And it adds the button, all right, but then the button doesn't seem to actually do anything. I select some text, click on it, and nothing happens. Any ideas?
Upvotes: 3
Views: 1071
Reputation: 1439
You can add a button and specify the 'exec' property, like so:
$('#wysiwyg').wysiwyg({
controls: {
tt: {
visible: true,
tags: ['tt'],
css: { class: 'tt', className: 'tt' },
exec: function(){
//Do Something
}
}
}
});
with $('#wysiwyg').wysiwyg('setContent', '') you can clear the textarea.
Upvotes: 3