val()
val()
Since: 1.3.5
Gets the current value of the editor.
This will return the filtered HTML from the WYSIWYG editor or the unfiltered contents of the source editor.
If using a format like the BBCode format, this will return the filtered HTML i.e. BBCode in the case of the BBCode format.
Syntax
var val = instance.val();
Return
Type: String
The filtered value of the editor
Sets the value of the editor.
If the filter
parameter is not set to false
the value will be run through the current editor format. This means that if using a format like BBCode, the value passed to this method should be BBCode and not HTML.
Syntax
instance.val(value[, filter]);
Parameters
value
Type: String
String to set as the editors value
filter
Type: Boolean
Default: true
If to filter the value through any plugins.
Example
Setting the value:
sceditor.instance(textarea)
.val('Hello World!');
If using the BBCode plugin, BBCode should be passed instead of HTML:
sceditor.instance(textarea)
.val('Hello [b]World![/b]');
If filter
is set to false
, HTML can be passed even when using the BBCode plugin:
sceditor.instance(textarea)
.val('Hello World!', false);