I have an example on my own site https://samliew.com/nric-generator
The section “Copy text from attribute” is what you need, on top of including the script from a CDN on the page.
Also, feel free to contact me for further code help and/or customization of third-party plugins