日期选择器PhP / JQuery

I looked for answers, but I am a newbie to PhP/JQuery so the answers I found confused me further.

I have a wordpress website that contains a form with a date selector field I am trying to determine when the user selects a new date and save that date to a variable to be used somwhere else

On change doesn't work cause of the lack of focus etc...

I tried select, and that didn't do anything

In the process of trying to figur eout what I am doing wrong, I simplified the code where once it is selected it gives me a message box! the code is below: Any help is greatly appreciated!

$JScript ="<script>
jQuery('#wdform_2_element13').on('select',function() 
        {
            alert('Here');

        }
</script>"
dongquechan4414
dongquechan4414 提供的代码SO人们只能猜测..请提供OP的所有相关代码
4 年多之前 回复

2个回答



您可以在从表单保存所有数据时停止该过程,并调用新函数进行保存或执行任何您想要的操作 该变量。</ p>

您可以将表单提交指向 wp-admin </ code>目录中名为 admin-post.php <的特定文件。 / code> </ p>

看一下本教程,我相信你将学习一些关于WP代码的基本知识以及你问题的答案:</ p>

https://www.sitepoint.com/handling-post -requests-the-wordpress-way / </ p>
</ div>

展开原文

原文

You can stop the process when your saving all your data from the form, and call a new function to save or do whatever you want to that variable.

You can do that by pointing your form submissions to a specific file in the wp-admin directory called admin-post.php

Take a look to this tutorial and I'm sure you will learn some basic knowledge about WP code and also the answer to your question:

https://www.sitepoint.com/handling-post-requests-the-wordpress-way/

doumianfeng5065
doumianfeng5065 我希望它有所帮助
大约 4 年之前 回复
dtqqq24248
dtqqq24248 谢谢,我会检查出来!
大约 4 年之前 回复



事实证明原因是该字段是一个日期选择器,它已经通过我正在使用的表单制作者定义。 所以我所做的是使用Jquery创建一个日期选择器,然后使用“onSelect:function”,那就是它</ p>

感谢您的帮助</ p>
</ div>

展开原文

原文

It turns out the reason is cause the field was a date picker that was already defined through the form maker i was using. So what I did was create a date picker using Jquery, then use the "onSelect:function" and that was it

Thanks for the help

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问