Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ <h2>Have a play.</h2>
<a href="#" class="btn btn-primary download-pdf">Download PDF</a>
</div>

<div id="character-counter">Characters entered: <span>0</span></div>

<label class="checkbox-inline">
<input type="checkbox" id="auto-refresh" checked="checked"> Auto refresh on changes?
</label>
Expand Down Expand Up @@ -95,6 +97,22 @@ <h2>Have a play.</h2>
});
</script>

<script>
$(document).ready(function() {
const editor = ace.edit("editor");
const $charCount = $('#character-counter span');
const session = editor.getSession();

function updateCharCount() {
const charCount = session.getValue().length;
$charCount.text(charCount);
}

editor.on('change', updateCharCount);
$(window).on('load', updateCharCount);
});
</script>

<!-- Code editor -->

<script src="./examples/js/ace.js" type="text/javascript" charset="utf-8"></script>
Expand Down
Loading
Loading