Forum Academy Marketplace Showcase Pricing Features

Stop user cursor before currency symbol on input

Hi guys,

Does anybody know a way of stopping a user from using the arrows keys or mouse clicking before the currency sign when using an input set to currency format? Demo below.



If not possible I suppose changing the input to numbers only to keep the decimal formatting and then adding the currency prefix in separately might be the answer…

Yes, just put the currency symbol as a text to the left outside the input field

Hey @robert
Appreciate the suggestion. I have a lot of inputs using the currency option, was hoping for a javascript solution to run in the header across the site, but I think I might run with the text solution if nothing comes up. Cheers


Javascript on page load:

// Basic cross browser addEvent
function addEvent(elem, event, fn){
elem.addEventListener(event, fn, false);
elem.attachEvent(“on” + event,
function(){ return(, window.event)); });
var element = document.getElementById(‘el’);

var that = this;
setTimeout(function(){ that.selectionStart = that.selectionEnd = 10000; }, 0);

Give your input an ID. In this case I used ‘el’.

Hopefully this is in the right direction?

Thanks @lantzgould this looks promising, I’ll run a test later tonight and see if I can get it running in the general <head>. Will keep you posted :+1:

1 Like

Did you get this working? I’d like to offset the caret position.

With Css seems I cannot find info. Js only.


Edit: Just centered it…

I found this but not sure if it’s possible to use in bubble.