Skip to content

Instantly share code, notes, and snippets.

@evo42
Created January 31, 2012 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save evo42/1708306 to your computer and use it in GitHub Desktop.
Save evo42/1708306 to your computer and use it in GitHub Desktop.
Aloha Editor with textarea

Using Aloha Editor with your textarea

This is an example on how to use Aloha Editor with a traditional editable.

Note: If the textarea has a HTML ID (eg. mytxtarea) the ID of the Aloha editable will be “-aloha” suffixed (eg. mytxtarea-aloha).

For more information see the Aloha Editor Guide: http://aloha-editor.org/guides/core.html

<?php
if (!empty($_REQUEST['myaloha-area'])) {
echo '<pre>';
print_r($_REQUEST);
echo '</pre>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>The Aloha Editor - Just another debugging page</title>
<link rel="stylesheet" href="../aloha-editor/css/aloha.css" id="aloha-style-include" type="text/css">
<script src="js/aloha-config.js"></script>
<script src="/aloha-editor/lib/aloha.js" data-aloha-plugins="common/format"></script>
</head>
<body>
<h1>Form + Textarea</h1>
<form method="get" id="myform">
<textarea id="myaloha-area" name="myaloha-area" cols="100" rows="15"></textarea>
</form>
<button id="submitForm">submit the form</button>
<script type="text/javascript">
Aloha.ready( function(){
var $ = Aloha.jQuery;
$('#myaloha-area').aloha();
$('#submitForm').click(function(){
$("form:first").submit();
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment