[英]Wordpress text editor field required in form
請幫助我通過JavaScript或任何HTML內容,以具有條件的必需函數的形式來修復以下文本編輯器。
我在前端使用wp編輯器字段上載求職者的簡歷。 但我希望此字段為必填(*),以便在此表單為空白之前不會提交表單。
$editor_id = 'resume_content';
$editor_css = '
<style>
.wp-editor-container{
border: 1px solid #e5e5e5;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}
.wp-switch-editor,
.tmce-active .switch-tmce, .html-active .switch-html{
height:25px;
}
</style>';
wp_editor( $default['resume_content'], $editor_id, array( 'editor_class' => 'form-control', 'media_buttons' => false, 'editor_css' => $editor_css, ) );
請用。
<?php wp_editor( $listing->post_content, 'listingeditor', $settings = array('textarea_name' => post_content) ); ?>
您可以使用過濾器功能:
add_filter("the_editor", "add_required");
function add_required($editor){
$editor = str_replace( '<textarea', '<textarea required="required"', $editor );
return $editor;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.