![](/img/trans.png)
[英]How do I assign an href value to a custom TinyMCE button in WordPress?
[英]WordPress TinyMCE custom button with input type number
我正在WordPress TinyMCE中创建自定义按钮。
一切顺利,但是在创建数字输入字段时,我没有得到任何参数来设置其最大和最小值。 以下是我的代码片段。 我尝试使用“ min”参数,但未成功:(
// Number of jobs
{
type: 'textbox',
subtype: 'number',
name: 'job_posts',
label: 'Posts',
min: -1,
},
如果有人知道确切的参数,请帮助我。 任何帮助将不胜感激。
谢谢,
目前,尚无办法。 但是您可以验证输入数据。 例如:
body: [
{
type: 'textbox',
subtype: 'number',
name: 'job_posts',
label: 'Posts'
}
],
onsubmit: function(e) {
if (e.data.job_posts < min_value) { // Change min_value to your preference.
// Do something.
} else if (e.data.job_posts > max_value) { // Change max_value to your preference.
// Do something else.
} else {
// Do other thing.
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.