/    Sign up×
Community /Pin to ProfileBookmark

toUpperCase moves cursor

All,

I am trying to change the text of an input text box to upper case as a user is typing. I can do this pretty easily using the toUpperCase function. However, every time a user enters a character the cursor jumps to the end of the string which is an issue when someone goes back to change the middle of the string. I have found some samples out there on how to accomplish this using the addEventListener for KeyUp. The problem with that solution is that I have multiple functions being called and am not sure how to pass multiple functions to and addEventListener invocation.

Can anyone please provide assistance?

Thanks in advance
Jack

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJul 21.2008 — You can use css to force the input to [B]display [/B]in upper case, and save a lot of key events:

.uppercaseClass{text-transform:uppercase}

If you need the value in uppercase for client side operations, convert it onchange or onblur.
×

Success!

Help @jhough76 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...