javascript - Onclick change text and tel -


scrip reveals phone number on click

 <script>     function changetext(id) {     id.innerhtml = "<?php echo $phone ?>"     }     </script> 

href

$string .= '<a href="tel:" onclick="changetext(this)" class="btn btn-info btn-lg"></a>'; 

when clicked reveals $phone, isn't callable.

how reveal , call it?

you can't click anchor call number, because number never added href, want href looks href="tel:5647564354" etc.

function changetext(id) {     id.innerhtml = "<?php echo $phone ?>";     id.href = "tel:<?php echo $phone ?>"; } 

Comments