/    Sign up×
Community /Pin to ProfileBookmark

Prevent tab text highlight / disable tab text selection

Hi,

Here’s a sample form:

[CODE]<form action=”#” method=”post”>
Name:<br />
<input type=”text” name=”name” value=”your name” /><br />
E-mail:<br />
<input type=”text” name=”mail” value=”your email” /><br />
<input type=”submit” value=”Send”>
</form>[/CODE]

When you tab to a text input, the value gets highlighted. How can it be disabled?

Any help is appreciated!
Mike

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@rproctor83Apr 21.2011 — Oh sorry I posted a reply in the wrong thread... Sorry, I don't see how to delete this... I will see if I can't find a solution for your question though.
Copy linkTweet thisAlerts:
@rproctor83Apr 21.2011 — Here you go, you can try this... It will prevent text from selecting on tab

[CODE]<input onselect="return false" type="text" value="no selecting this text with tab" />[/CODE]
Copy linkTweet thisAlerts:
@Rain_LoverauthorApr 22.2011 — Here you go, you can try this... It will prevent text from selecting on tab

[CODE]<input onselect="return false" type="text" value="no selecting this text with tab" />[/CODE][/QUOTE]


Thanks for the answer, but Firefox seems to be the only browser in which your code works correctly.
×

Success!

Help @Rain_Lover 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 7.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres
});

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: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 1000 SATS,

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