hey everyone, on chrome there is a quite misleading bug.
If I have a mask input set (custom phone number), I will see the underline with the number of accepted characters, but if I dont click at the beginning of the field I will go at the last char, and so I cant type anything. I have to click at the beginning of the field which is not really good for the user, it should get the cursor to the very first character to type the phone number, wherever I click on the field.
Look like im not alone with this :
Is there a way to fix this ? I think I will have to use some custom JS to force the cursor going the first character…
I think this is specific for phone number… In France we don’t use this format of phone, so it doesn’t really help me.
And in fact I want to fix this issue on all field that have mask, not only phone number because I have like 10 fields that have mask.
EDIT :
Tried this code (look like same code as your link) :
It work on the first page of my multipage form… I also wait that the page is loaded to strike the JS code but for now It dont work on field that are on other page.
jQuery(document).ready(function ()
{
//https://community.gravityforms.com/t/cursor-position-when-input-mask-is-set/11708/3
jQuery( document ).on('mouseup','.force_cursor_placement', function (e)
{
if (e.target.value.replace(/\(|\)|_|-|\./g,'').trim() == '')
{
e.target.setSelectionRange(0,0);
}
});
});
Only bad things is that if the user partially complete the field, click on another field or anywhere else, it deletes the field value. (Maybe you can help me to fix this ?)