Problem in the hyperlink for linking to phone numbers

1

I have a field inside a table, where the phone backs up from the database, in a format string (xxx) xxxx-xxxx . I want the moment I click on 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 opens the option and even chooses the program, but it only takes (xxx) and not the full phone (xxx) xxxx-xxxx What can it be?

    
asked by anonymous 11.01.2018 / 17:12

2 answers

3

Try to put a link without any special characters like:

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

With your JS in case already handling this:

'<a href="tel:'+properties.telefone.replace(/\(|\)| |\-/g, '')+'">(99) 9999-9999</a>'
    
11.01.2018 / 23:19
0

I believe 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 */
    
11.01.2018 / 23:58