Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HOWTO - trigger source button in ckeditor by another button which is outside the editor

Tags:

ckeditor

I have a textarea which is behaving like a ckeditor. In the editor there is a button to view the content as source/html. I have a input button above the textarea to preview the textarea content as html Means on click of my preview button it will trigger the ckeditor button click. Can anybody help me please..?

like image 918
sandeep.mishra Avatar asked Mar 23 '23 09:03

sandeep.mishra


1 Answers

Shortest answer ever:

editor.execCommand( 'source' );
like image 67
Reinmar Avatar answered Apr 06 '23 11:04

Reinmar