Link for connection to phone numbers

1

I have a form where various user information is registered, including phone numbers and, after being registered, you can view the registration by opening a form that is the same as the previous one with disable fields that are the same as the fields filled in at the time of registration

I would like to turn this number into a link so that the user can call the form number if it is on a mobile device and I thought it would just be me to href , but since I am getting this information from the bank and playing text box, I do not know how to turn into link.

<div class="form-group col-md-6">
		<label for="telefone">Telefone:*</label>
		<div class="input-group phone">
		  <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span><input required type="phone" class="form-control" id="telefone" name="telefone" placeholder="Digite o seu telefone:" value="<?=$row['telefone'];?>" disabled>
		</div>
	</div>

Iwastryingthesamehrefanditlookedlikethis:

Can anyone give me an idea how to do this?

    
asked by anonymous 11.10.2017 / 20:03

3 answers

0

As you want the click to work on input , not anchor , I suggest creating a click event on your input via javascript.

Add the onclick property to the input:

onclick="window.open('tel:<?=$row['telefone'];?>');";

It would look like this:

<div class="form-group col-md-6">
    <label for="telefone">Telefone:*</label>
    <div class="input-group phone">
        <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span><input required type="phone" class="form-control" id="telefone" name="telefone" placeholder="Digite o seu telefone:" value="<?=$row['telefone'];?>" disabled onclick="window.open('tel:<?=$row['telefone'];?>');">
    </div>
</div>
    
23.10.2017 / 15:34
7

You can only print the value in the href of tag A.

For example:

 <a href="tel:<?=$row['telefone'];?>"><?=$row['telefone'];?></a>

You may need to remove special characters from href if it does not work in a specific browser. For this, you can use:

 <a href="tel:<?=preg_replace('/[^0-9]/', '', $row['telefone']);?>"><?=$row['telefone'];?></a>

I hope I have helped.

    
11.10.2017 / 20:24
4

You can try:

<a href="tel:55-5555-12345">(55) 5555-12345</a>
    
11.10.2017 / 20:04