Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I deactivate Bootstrap-wysihtml5 jquery editor instance?

Tags:

wysihtml5

I'm using the Bootstrap-wysihtml5 jquery plugin (https://github.com/jhollingworth/bootstrap-wysihtml5/) to convert textareas to WYSIWYG. I would like to be able to activate and deactivate the editor by clicking on 2 buttons, so far i can show the editor, please will you let me know how i can deactivate the editor and leave just the textarea and its value. My code is as follows:-

HTML

<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>

<input type="button" id="button1" value="Show Editor"> 
<input type="button" id="button2" value="Hide Editor">

Script

$("#button1").click(function(){
$('textarea').wysihtml5();
});

$("#button2").click(function(){
// this is where i'm stuck
});

Thank you

like image 973
boeing Avatar asked Feb 13 '26 00:02

boeing


1 Answers

A few lines of custom JS code. I think they can help you.

var content = $('#content');
var contentPar = content.parent()
contentPar.find('.wysihtml5-toolbar').remove()
contentPar.find('iframe').remove()
contentPar.find('input[name*="wysihtml5"]').remove()
content.show()
like image 194
Yura Galavay Avatar answered Feb 21 '26 04:02

Yura Galavay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!