Search code examples
javascripthref

How to display a href on hover when use variable value in HTML,


I am developing a vuejs application and I have a call button. I want to see and use a phone number for calling but I cannot use or display it. I tried to use as a dynamic phone number in the anchor tag, href parameter. I used a variable inside href, named phone as -> href = "tel:phone" , but shows tel:phone instead of the variable value. coulnt try real call withhref:tel but When I use it on my html code, when hover mouse on it, I see tel:phone on left down corver of the screen,I dont see the phone number

I tried tried this -z href= "'tel:' + phone" but did not work.

I tried onclick method, no work.

<a ref="myhref" href="tel:23432"

I tried manipulating href but did not work.

this.$refs.myhref.href = 'tel:' + phone

Solution

  • The solution is to use binding ->, like this:

    <a :href="'tel:' + phone">