Last active
March 2, 2022 12:14
-
-
Save soomtong/6635053 to your computer and use it in GitHub Desktop.
(deprecated) summernote example with php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- this version of sample is too old. it's not follow recent version of summernote api --> | |
<!-- should check new apis and examples! sorry I am. --> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<!-- include libries(jQuery, bootstrap, fontawesome) --> | |
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script> | |
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.no-icons.min.css" rel="stylesheet"> | |
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> | |
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet"> | |
<!-- include summernote css/js--> | |
<link href="build/summernote.css" / rel="stylesheet"> | |
<script src="build/summernote.min.js"></script> | |
<body> | |
<div class="summernote container"> | |
<div class="row"> | |
<div class="span12"> | |
<h2>POST DATA</h2> | |
<pre> | |
<?php print_r($_POST); ?> | |
</pre> | |
<pre> | |
<?php echo htmlspecialchars($_POST['content']); ?> | |
</pre> | |
</div> | |
</div> | |
<div class="row"> | |
<form class="span12" id="postForm" action="/summernote.php" method="POST" enctype="multipart/form-data" onsubmit="return postForm()"> | |
<fieldset> | |
<legend>Make Post</legend> | |
<p class="container"> | |
<textarea class="input-block-level" id="summernote" name="content" rows="18"> | |
</textarea> | |
</p> | |
</fieldset> | |
<button type="submit" class="btn btn-primary">Save changes</button> | |
<button type="button" id="cancel" class="btn">Cancel</button> | |
</form> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('#summernote').summernote({ | |
height: "500px" | |
}); | |
}); | |
var postForm = function() { | |
var content = $('textarea[name="content"]').html($('#summernote').code()); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi friends, I am not able to get html content value in textarea field when I clicked on edit button. Here I am using summernote editor.
here html code:-
<textarea name="description" id="summernote" cols="30" rows="10" value="{{x.description}}">{{x.description}}</textarea>
here script;-
<script> $('#summernote').summernote({ height: 300 }); </script>
Please help me.