Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

href link to function js

I want to create link that send to function:

    tdLink2.innerText="Delete";
    tdLink2.href="javascript:deleteDepartment(id)"

but the "id" parameters was not sent.
Who I can do this with the parameters? (Javascript)
Thank you.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If id is already defined variable then u can do like this

tdLink2.href=`javascript:deleteDepartment(${id})`

U can do this if id is of type string

otherwise u can go for this

function f(){
  deleteDepartment(id)
}
tdLink2.href='javascript:f()'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading