editor
by M Shameer
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.3.0/jquery.form.min.js"></script>
<script src="https://cdn.ckeditor.com/4.16.2/standard/ckeditor.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.14.1/adapters/jquery.js"></script>
<title>Document</title>
<script>
$( document ).ready( function() {
$('textarea#editor1' ).ckeditor();
$.get('aa.htm').done(response=>{CKEDITOR.instances['editor1'].setData(response);}).fail(/** process error here **/);
} );
$('form').ajaxSubmit( {
beforeSubmit: function() {
// The textarea is already updated now and has the same value as the editor, so you can validate it.
}
});
</script>
</head>
<body>
<form>
<textarea cols="80" id="editor1" name="editor1" rows="10" >Lorem ipsum</textarea>
<input type="submit" value="Save">
</form>
</body>
</html>