自动输入从输入到textarea并在textarea中包装文本?(Auto type from input to textarea and wrap text in textarea?)

系统教程 行业动态 更新时间:2024-06-14 16:59:17
自动输入从输入到textarea并在textarea中包装文本?(Auto type from input to textarea and wrap text in textarea?)

当我输入此输入字段时:

<fieldset class="usp-title"> <label for="user-submitted-title"><?php esc_html_e('Search', 'usp'); ?></label> <input id="user-submitted-title" name="user-submitted-title" type="text" value="" placeholder="<?php esc_attr_e('Search', 'usp'); ?>"<?php if (usp_check_required('usp_title')) echo $usp_required; ?> class="usp-input"> </fieldset>

我想让它自动输入这个字段,但这里的文字应该被标签所包围:

<fieldset class="usp-content"> <?php if ($usp_options['usp_richtext_editor'] == true) { ?> <div class="usp_text-editor"> <?php $usp_rte_settings = array( 'wpautop' => true, // enable rich text editor 'media_buttons' => true, // enable add media button 'textarea_name' => 'user-submitted-content', // name 'textarea_rows' => '10', // number of textarea rows 'tabindex' => '', // tabindex 'editor_css' => '', // extra CSS 'editor_class' => 'usp-rich-textarea', // class 'teeny' => false, // output minimal editor config 'dfw' => false, // replace fullscreen with DFW 'tinymce' => true, // enable TinyMCE 'quicktags' => true, // enable quicktags 'drag_drop_upload' => true, // enable drag-drop ); $usp_rte_settings = apply_filters('usp_editor_settings', $usp_rte_settings); $usp_editor_content = apply_filters('usp_editor_content', ''); wp_editor($usp_editor_content, 'uspcontent', $usp_rte_settings); ?> </div> <?php } else { ?> <label for="user-submitted-content"><?php esc_html_e('Post Content', 'usp'); ?></label> <textarea id="user-submitted-content" name="user-submitted-content" rows="5" placeholder="<?php esc_attr_e('Post Content', 'usp'); ?>"<?php if (usp_check_required('usp_content')) echo $usp_required; ?> class="usp-textarea"></textarea> <?php } ?> </fieldset>

第二个字段应该[bbcode]copied from input[bbcode]的[bbcode]copied from input[bbcode]获取文本

While I am typing in this input field:

<fieldset class="usp-title"> <label for="user-submitted-title"><?php esc_html_e('Search', 'usp'); ?></label> <input id="user-submitted-title" name="user-submitted-title" type="text" value="" placeholder="<?php esc_attr_e('Search', 'usp'); ?>"<?php if (usp_check_required('usp_title')) echo $usp_required; ?> class="usp-input"> </fieldset>

I want it to automaticly type in this field, but text in here should be sorrounded by tags:

<fieldset class="usp-content"> <?php if ($usp_options['usp_richtext_editor'] == true) { ?> <div class="usp_text-editor"> <?php $usp_rte_settings = array( 'wpautop' => true, // enable rich text editor 'media_buttons' => true, // enable add media button 'textarea_name' => 'user-submitted-content', // name 'textarea_rows' => '10', // number of textarea rows 'tabindex' => '', // tabindex 'editor_css' => '', // extra CSS 'editor_class' => 'usp-rich-textarea', // class 'teeny' => false, // output minimal editor config 'dfw' => false, // replace fullscreen with DFW 'tinymce' => true, // enable TinyMCE 'quicktags' => true, // enable quicktags 'drag_drop_upload' => true, // enable drag-drop ); $usp_rte_settings = apply_filters('usp_editor_settings', $usp_rte_settings); $usp_editor_content = apply_filters('usp_editor_content', ''); wp_editor($usp_editor_content, 'uspcontent', $usp_rte_settings); ?> </div> <?php } else { ?> <label for="user-submitted-content"><?php esc_html_e('Post Content', 'usp'); ?></label> <textarea id="user-submitted-content" name="user-submitted-content" rows="5" placeholder="<?php esc_attr_e('Post Content', 'usp'); ?>"<?php if (usp_check_required('usp_content')) echo $usp_required; ?> class="usp-textarea"></textarea> <?php } ?> </fieldset>

Second field should get text sorrounded by [bbcode]copied from input[bbcode]

最满意答案

// When the user types a letter $("#user-submitted-title").keyup(function(){ // Grab the value, append the tags and drop it into the textarea $("#user-submitted-content").val("[bbcode]"+$(this).val()+"[bbcode]"); }); // When the user types a letter $("#user-submitted-title").keyup(function(){ // Grab the value, append the tags and drop it into the textarea $("#user-submitted-content").val("[bbcode]"+$(this).val()+"[bbcode]"); });

更多推荐

本文发布于:2023-04-16 14:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/f139c22d5bcb1d51ce6e3dab7aa945bb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:并在   文本   Auto   textarea   wrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!