In order to have a static part "+91" displayed in an input field upon focus, I have successfully replaced the placeholder during onFocus and onBlur events. However, I am unable to add a listener to read content from :before.
<div class="goal-mobile">
<input id="mobileField" onblur="this.placeholder = 'Enter your mobile number'" onfocus="this.placeholder = ''" type="tel" class="input-mobile"/>
</div>
.goal-mobile{
position: relative;
&:before{
content: "+91";
position: absolute;
left: 20px;
top: 20px;
color: rgba(3,3,3,.6);
}
}
Although the class is set to load "+91" by default, I need it to be loaded when the input field is focused. I have tried using :focus::before{} without success. What alternative method can I use to achieve the default static display of "+91" in the input box upon onFocus?
PS: Since I am using the Vue JS framework, implementing jQuery may not be straightforward.