Hi, This is my first post on the here so, Hi all!!

I have an issue with an online application form I am building. I need a #payfreq dropdown field to populate two inputs (#payday and #nextpayday) depending on the option selected.

The options being "last Friday of the Month", "last Thurs of the Month", "last Wed of the Month"...etc

I have used Date.js and made some variables to return the correct values

Code:
var lastFriday = Date.today().final().fri()
My question is, how do link everything together? So when an option in the dropdown is selected it references the correct variable(s) and then populates the #payday & #nextpayday fields?

My JS is none existent really and in the past relied on plugins etc to help (perhaps its time to start learning!!)

I look forward to a response and thank you in advance.
Phil