I've a responsive django app that shows a phone number on a button click. I'd like to trigger phone call on mobile devices. How do I detect the device such that the call to phone action only happens on mobile devices and on desktop it only shows text ? I've seen this post How to Trigger a phone call when clicking a link in a web page on mobile phone but it doesn't help much.
<input onclick="change()" class="btn btn-primary phone" type="button" value="Show Phone Number" id="myButton1" />
<script type="text/javascript">
function change()
{
var elem = document.getElementById("myButton1");
elem.value = "" + {{contact_no}};
}
</script>
Aucun commentaire:
Enregistrer un commentaire