This is the code that i am trying to apply :
Text Box Id First name : fname
Text Box Id Last Name : lname
Text Box Id Company Name : cname
The text that need to be changed once text in area box inputed : cardtext
button to call action : btncard
<script>
let text = ''
const cardText = document.querySelector('#cardtext')
const fname = document.querySelector('#fname')
const lname = document.querySelector('#lname')
const cname = document.querySelector('#cname')
const previewBtn = document.querySelector('#btncard')
previewBtn.addEventListener('click', () =>{
text = <code>${fname.value} ${lname.value} ${cname.value}</code>
cardText.value = text
})
</script>