I built a simple NHS annual leave calculator using HTML and JavaScript. When I test it locally by saving the file with the .htm extension in Notepad, everything works as expected. The calculator loads, and the result appears correctly. But once I insert the same code into my WordPress site, it stops functioning. The input box and button show up, but when I click the button, nothing happens and no calculation is displayed.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
without seeing your code, it's not easy to tell why.
My idea is that you should convert it to a WP plugin (use AI to do that if you are not proficient enough)
The thing is that probably you miss one step:
WP sends input data to the DB and then outputs them where it should
This means that your HTML/JS capture the form input > VALIDATE IT > SEND TO SERVER > SERVER VALIDATES THEM WITH PHP REGEX TOO > SERVER PUTS THEM INTO DB > There is a function on the front-end to call the output
What you can do:
Create a shortcode that outputs the form to input data, and one to show the data and use the shortcodes in a WP template. You can create all that in a WP plugin, then install it and you are done.