I have no backend skills yet, i'm just trying to find out if I can create this functionality using javascript and run it on my browser.
I want a birthday input field, and a submit button.
I want to take the birthday data, and add all the individual numbers together, and then add the digits of that sum to get a single digit.
For example:
10/9/1940 would calculate 1+0+9+1+9+4+0. Which would equal 24. Then it would add the digits 2+4. Which equals 6.
Then, I want to print that number at the end of an h1 that says, "your combined birthday number is: 6"
Any tips? I dont have any idea how to link the input data in a birthday form to a submit button.
Yes - if you do not need information to persist beyond a reload of the page, then you can do almost anything with JavaScript. Your use case is not that different from W3Schools' JS tutorial - besides a button, the form would just need a date entry field, and a few lines to do your calculation and apply the changes to the page. I recommend going through that to get an idea of the possibilities.
A server is only required if you want a system to act autonomously or remember across multiple users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With