Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to call a phone number through javascript without using <a> tag?

I designed a mobile web page. There I have a phone number field, which on clicking should call that particular number. I can't use:

<a href="tel:+1800229933"></a> 

Because I have added the phone number field using table tag as follows:

<table>   <tr>     <td>Phone: 900 300 400</td>   </tr> </table> 

Are there any other methods(like OnClick event) to call that phone number on clicking that column?

like image 898
msg Avatar asked Jul 27 '13 11:07

msg


People also ask

How do you href a phone number?

Href=tel: creates the call link. This tells the browser how to use the number. “Tel: 123-456-7890 “creates the HTML phone number. The number within the quotes is the number it will call.

How do I make a call in react JS?

To use call we have to install react-native-phone-call package. This command will copy all the dependencies into your node_module directory. –save is optional, it is just to update the react-native-phone-call dependency in your package. json file.


1 Answers

You can simply add an onclick handler to your <tr> tag, then call window.open("tel:+1800229933");.

Like so:

<table>   <tr onclick="window.open('tel:900300400');">     <td>Phone: 900 300 400</td>   </tr> </table>  
like image 99
idmadj Avatar answered Sep 23 '22 16:09

idmadj