How to create a click to call button in html?
Description
This knowledge base article clearly explains on how to create a click-to-call button for HTML using JavaScript.
Solution
It can be achieved by customizing the anchor element using css classes e-btn e-link and setting the href property with tel: and required phone number.
[HTML]
<head> <link href="//cdn.syncfusion.com/ej2/ej2-base/styles/material.css" rel="stylesheet" /> <link href="//cdn.syncfusion.com/ej2/ej2-buttons/styles/material.css" rel="stylesheet" /> </head> <body> <div> <a class="sf-icon-telephone e-btn e-link" href="tel:1800123456"> 1800 123 456</a> </div> </body>
Demo Sample: https://stackblitz.com/edit/js-unpzeq?file=index.html
Conclusion
I hope you enjoyed learning about how to create a click-to-call button for HTML using JavaScript.
You can refer to our Javascript Button Feature Tour page to know about its other groundbreaking feature representations.
For current customers, you can check out our File Formats from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our all platforms.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!