Hyperlink problem for connection to phone numbers

Asked

Viewed 98 times

1

I have a field inside a table, where behind the bank the given phone, in a string format (xxx) xxxx-xxxx . I want the moment I click the phone, open the option to choose which program I will use to make the call. (for example skype). I used the format <a href=\"tel:"+properties.telefone+"\"> It makes open the option and even choose the program, but it only takes the (xxx) and not the full phone (xxx) xxxx-xxxx What can it be?

  • What code do you have so far?

  • @Paulohdsousa I only used <a href="tel:"+properties.+"">

  • Isn’t it because of the space between the ) and the x? Vc tried (xxx)xxxx-xxxx all together without space?

  • Hard to know without the code, can be a lot of things.

  • @hugocsl I just used this code nothing else. I thought it could be the space, but it comes from the bank, there is no way to treat this on the front? Take this space? This field is within a td.

  • 1

    Try with the phone in the format xxx-xxxx-xxxx.

  • 1

    @Isa tries some way to treat that space to see if it resolves. Or we wait to see if anyone has any more tips.

Show 2 more comments

2 answers

3

Look for a link with no special character like:

<a href="tel:9999999999">(99) 9999-9999</a>

With your JS on the case already handling this:

'<a href="tel:'+properties.telefone.replace(/\(|\)| |\-/g, '')+'">(99) 9999-9999</a>'
  • Is that right? Mine wasn’t

0

I believe that something like this should help you! If Negative, explain better what you need so I can help you.

var telefone_banco='(012) 3456-7890'; 

var tel_sem_espaco=telefone_banco.replace(" ","");

var tel_sem_hifen=tel_sem_espaco.replace("-","");

var tel_sem_parenteses=tel_sem_hifen.replace("(","").replace(")","");

var telefone = tel_sem_parenteses;

/* Continua seu código */

Browser other questions tagged

You are not signed in. Login or sign up in order to post.