Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I do this without a server?

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.

like image 299
nineborn Avatar asked Jun 23 '26 18:06

nineborn


1 Answers

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.

like image 167
MBer Avatar answered Jun 26 '26 08:06

MBer