jwysiwyg Using the current textarea value as Initial Content
jquery
Solution
Is this what you are looking for: http://jsfiddle.net/QjBh4/
Hope this fits your need `:))`
P.S. - Please feel free to use my demo and create your issue, I will defo try and help you out, if I missed anything!
Script source et. al.
<link rel="stylesheet" type="text/css" href="http://akzhan.github.com/jwysiwyg/help/lib/blueprint/screen.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="http://akzhan.github.com/jwysiwyg/help/lib/blueprint/print.css" media="print" />
<link rel="stylesheet" href="http://akzhan.github.com/jwysiwyg/jquery.wysiwyg.css" type="text/css"/>
<script type="text/javascript" src="http://akzhan.github.com/jwysiwyg/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="http://akzhan.github.com/jwysiwyg/controls/wysiwyg.image.js"></script>
Sample code
(function($) {
$(document).ready(function() {
$('textarea').each(function() {
value_of_textarea = this.value;
$(this).wysiwyg({
autoGrow: true,
initialContent: function() {
return value_of_textarea;
},
controls: "bold,italic,underline,|,undo,redo"
});
});
});
})(jQuery);
Problem
I'm using jwysiwyg on multiple textarea's on one page. However my textarea's have initial pre-filled values which I need it to use. Instead jwysiwyg's default 'Initial content' is used. my code is: ``` $(document).ready(function(){ $('textarea').wysiwyg({ autoGrow:true, initialContent: this.value, controls:"bold,italic,underline,|,undo,redo" }); }); ``` Appreciate I could call each textarea individually by id but that seems like lines of code for the sake of it. Think my issue is all down to the way I'm referncing 'this.value' but cant figure it out. I can solve this by changin the following in jswysywig.js 'initialContent = original.val();' change to 'options.initialContent = original.val();'