Is there a way to make only a portion of text in a text area static or read-only without disabling the entire text area?

Basically, I want a person to be able to update a status using a textarea, and the static text would have their name and the verb is at the begining, like:

Eric is: "Riding a bike"

Is this possible?

Basic text area <input="textarea" blah="" blah"">

没有正确的解决方案

其他提示

Further to the wishes of Jukka,

Not without using javascript to fake the effect. You'd have to handle keyboard events, mouse events and be able to identify your caret position within the textarea - all in a cross-browser friendly way. I'd run to the hills with my hands in the air!....

Or use something that makes more sense -

Show the "Eric is:" inside a label, have the "Riding a bike" inside a text input. The javascript needed to populate the label with that text is minuscule compared to that required to do it all with a textarea. The markup could be as simple as:

<label>Eric is: <input type='textarea' blah="\" blah\"" value='Riding a bike'></label>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top