i’m building a mobile app using phoenix framework, i want when the user press on the call number button it dials that number.
what i tried:
-
<a class="text-zinc-900 text-sm font-medium" href="tel:10000" target="_blank"><%= gettext("10000") %></a>
-
<a class="text-zinc-900 text-sm font-medium" href="tel:10000""><%= gettext("10000") %></a
3. <a onclick="window.open('tel:10000')" class="external">10000</a>
-
<button class ="bg-red-500" id="dial_button" phx-hook="Dial" >Call 10000</button>
and in the javascript file
`const Dial ={
mounted(){
const call = document.getElementById(“dial_button”)call.addEventListener("click", function(){ window.location.href = "tel:10000"; })
}
}
export default Dial;`
please if you have any ideas how can I do it with a different approach please advise me.