我正在使用插件“强有力的证明”。https://de.wordpress.org/plugins/strong-testimonials/我需要限制用户可以在评论表单中键入的最大字符数。在检查我的页面时,表单呈现为
<textarea id="wpmtst_post_content" name="post_content" class="" required="" tabindex="0" aria-required="true" maxlength="10"></textarea>我只需要添加“php”10“属性,但由于maxlength=代码是用php汇编的,我找不到把它放在哪个PHP文件中的位置。我注意到表单字段存储在数组中,这将在请求时分解,但我对PHP一无所知,也不知道我应该把它放在哪里。谢谢AO
发布于 2018-02-01 14:07:25
不需要修改PHP代码,你可以用javascript来完成。
$(document).ready(function(){
$('#wpmtst_post_content').attr('maxlength',10);
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="wpmtst_post_content" name="post_content" class="" required="" tabindex="0" aria-required="true"></textarea>
https://stackoverflow.com/questions/48554933
复制相似问题