Encode command
A simple command to encode the content of an element, especially usefull for pre and code elements.
Basic Usage (HTML)
data-jkit="[encode:format=text]"
Advanced Init (JavaScript)
$('#myelement').jKit('encode', { 'format': 'text' });
Options
Option | Values | Default | Description |
---|---|---|---|
format | “code”, “text”, “esc” or “uri” | code | The format used to encode the html |
fix | “yes” or “no” | yes | If the code format is used, this option will indent the code without unneaded whitespace |
Events
Examples
Basic demos:
Demos of the four decoding types, “code”, “text”, “esc” and “url”:
Encode
Encode
Encode
Encode
Source:
<pre data-jkit="[encode]"><h2 id="command_encode">Encode</h2></pre> <div class="box" data-jkit="[encode:format=text]"> <h2 id="command_encode">Encode</h2> </div> <div class="box" data-jkit="[encode:format=esc]"> <h2 id="command_encode">Encode</h2> </div> <div class="box" data-jkit="[encode:format=uri]"> <h2 id="command_encode">Encode</h2> </div>
Advanced demo:
Here’s an example where we first use the text format and than we’re using an uppercase format that we added through jKits replacements feature (check the head source):
Encode
Source:
<div class="box" data-jkit="[encode:format=text][encode:format=uppercase]"> <h2 id="command_encode">Encode</h2> </div>
Replacements
There are currently no replacements for this command.
[ Learn more about replacements ]
Discussions
Do you have questions or do you want to suggest new features? Than head over to our new community:
[ jKit Community ]