javascript - Input box text value trick -


i'm looking solution have input box has value in, , value cannot changed, although if user goes enter information box, can add name along side value, value cannot deleted.

here's example:

first name: 

if user clicks on box can enter first name.

first name: kate 

'first name' cannot deleted though , if possible not value.

i think possible can imagine it's tricky do. saw on website once can't remember where.

you can use mask control or @ least same principles. advantage of approach covers needs regarding using text input , won't confuse users usability _ on controls let users know can removed , cannot.

here example jquery-mask-plugin

online demo

your html

<input id="txt1" type="text" value="" tabindex="1" /> 

your script

jquery(function($) {       $('#txt1').mask('something:a*****');      $('#txt1').val('something:');     }); 

disclaimer: though used jquery mask plugin no saying right choice application or choice think can guide or give ideas on how problem can resolved.

hope helps!

http://jsfiddle.net/5qwqh/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -