There's a ckeditor that stores the text along with HTML tags in the database.
eg: description field in the database has the following data
<p><strong>Name:</strong> <i>James Sun.</i></p>
<p>description here</p>
I need to send this data in the javascript onclick
function. But it gives an error here. If the description field (database table) has plain text, it works but how to get the data saved through ckeditor with HTML tags using javascript.
HTML
<div onclick="descriptionChanges('<?php echo ($h->description) ?>')" > </div>
javascript
function descriptionChanges(description) {
console.log(description); // it gives err
}
You should be using the innerHTML property of javascript,here is the example.
<div id="desc">
<p>this is tesitng</p>
</div>
<script>
var htmldata = document.getElementById('desc').innerHTML
</scirpt>