what getContent() function does in jQuery? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what getContent() function does in jQuery?

I try to get content of wp_editor() in jQuery. i am getting this error: TypeError: Cannot read property 'getContent' of null. jQuery("#add_new").validate({ submitHandler:function() { var course_content = encodeURIComponent(tinyMCE.get("content_id").getContent()); } }); <div> <form id="add_new" name="registration" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post" enctype="multipart/form-data"> <?php $content = ''; $editor_id = 'content_id'; wp_editor( $content, $editor_id ); ?> <input type="submit" id="save_btn" name="save_course" class=" save_btn button button-primary" value="Save"/> </form> </div>

1st Aug 2020, 9:31 AM
DRO KOUAME LUCIEN
DRO KOUAME LUCIEN - avatar
1 Answer
+ 1
I think you have left # (as content_id) is an id . in 5th line of code Like .get("#content_id").get content(). So try with # once .
9th Aug 2020, 12:05 PM
Divya Mohan
Divya Mohan - avatar