I have a shortcode that prints a simple form, a button is used to submit the form. The problem is that when it’s pressed, the form gets submitted normally, ignoring the js function. I can’t understand why it’s doing this, since trying this locally on XAMPP works (I needed to change something to adapt the js code to WP, but nothing that should change its behavior.
This is the code of the function that returns the form markup (called by the add_shortcode
‘s callback function, if needed, I’ll add it here)
My plugin’s main file enqueues the required styles/scripts this way
The js file that’s giving me problems has the following content:
the jQuery( document ).ready
function gets called successfully, I tried putting an alert just below it and it showed up immediately. All the required scripts are loaded, I manually checked both by searching it in Inspect Element “Element” and “Source” tabs (according to how Opera Browser calls them).
What should happen can be seen on my non-wordpress website here
What am I doing wrong? (I know that solving this issue, there’s ajax to handle, but I’m struggling to understand how to convert my code to wp ajax, and it would be great if you could help me with that too)
Thank you in advance to everyone.
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com