admin管理员组文章数量:1130349
Any ideas how I could add a cancel button, like the default one in the Publish meta box, to a custom meta box?
The standard code is <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel">Cancel</a> I guess it's using some js to do the cancel/reset action so it's not easy to replicate.
I basically want to add a button that will clear an input field in my meta box. input type=reset will clear all the fields on the page, so I wanted to see if I could use WP's toolset.
Open to ideas for the best solution here.
Any ideas how I could add a cancel button, like the default one in the Publish meta box, to a custom meta box?
The standard code is <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel">Cancel</a> I guess it's using some js to do the cancel/reset action so it's not easy to replicate.
I basically want to add a button that will clear an input field in my meta box. input type=reset will clear all the fields on the page, so I wanted to see if I could use WP's toolset.
Open to ideas for the best solution here.
Share Improve this question asked Oct 20, 2018 at 17:05 SalSal 1535 bronze badges 2- Have you added a cancel button? Even if it's non-functional, I think you can ignore the whole metabox/WP thing and treat this as a pure "I have a series on input form elements inside of a div container, how do I clear them when a link is clicked?". If you're looking for a WP specific way to do this though, there isn't one – Tom J Nowell ♦ Commented Oct 20, 2018 at 17:31
- Yeah, I was hoping for a Wordpress-specific way to do this. If there isn't something like that, then I can use a line of js to handle it. – Sal Commented Oct 20, 2018 at 19:38
1 Answer
Reset to default 0I ended up using this:
<a class="clear_button hide-if-no-js button-cancel" title="clear" data-clear style="text-decoration:underline;">Clear</a>
It does the job. I was hoping for something more "Wordpressy" but don't see a metabox cancel function.
Any ideas how I could add a cancel button, like the default one in the Publish meta box, to a custom meta box?
The standard code is <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel">Cancel</a> I guess it's using some js to do the cancel/reset action so it's not easy to replicate.
I basically want to add a button that will clear an input field in my meta box. input type=reset will clear all the fields on the page, so I wanted to see if I could use WP's toolset.
Open to ideas for the best solution here.
Any ideas how I could add a cancel button, like the default one in the Publish meta box, to a custom meta box?
The standard code is <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel">Cancel</a> I guess it's using some js to do the cancel/reset action so it's not easy to replicate.
I basically want to add a button that will clear an input field in my meta box. input type=reset will clear all the fields on the page, so I wanted to see if I could use WP's toolset.
Open to ideas for the best solution here.
Share Improve this question asked Oct 20, 2018 at 17:05 SalSal 1535 bronze badges 2- Have you added a cancel button? Even if it's non-functional, I think you can ignore the whole metabox/WP thing and treat this as a pure "I have a series on input form elements inside of a div container, how do I clear them when a link is clicked?". If you're looking for a WP specific way to do this though, there isn't one – Tom J Nowell ♦ Commented Oct 20, 2018 at 17:31
- Yeah, I was hoping for a Wordpress-specific way to do this. If there isn't something like that, then I can use a line of js to handle it. – Sal Commented Oct 20, 2018 at 19:38
1 Answer
Reset to default 0I ended up using this:
<a class="clear_button hide-if-no-js button-cancel" title="clear" data-clear style="text-decoration:underline;">Clear</a>
It does the job. I was hoping for something more "Wordpressy" but don't see a metabox cancel function.
本文标签: pluginsAdd Cancel Button to a Custom Meta Box
版权声明:本文标题:plugins - Add Cancel Button to a Custom Meta Box 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749244885a2338709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论