开发者

Make text field as a select box

When we click on a dropdown 开发者_开发百科we dont see cursor, we just see the whole box with value gets selected, can we do same with text field because in text field I see the cursor blinking.

see image if confused. :D

Make text field as a select box


Did you mean you want to disable the text input field? (Thats what I can think). Try this:

<input type="text" disabled="true" />

What are you trying to accomplish?

Edit: Read only:

<input type="text" value="Some value" readonly="readonly" />

I think this is what you are looking for. Read only with no focus.

<input type="text" value="Some value" onfocus="this.blur()" readonly="readonly" />

Edit 3, Solving Tab Index problem:

Previous field: <input type="text" tabindex=1/>
Disabled field: <input type="text" value="Some value" onfocus="this.blur()" readonly="readonly" />
Next Field:     <input type="text" tabindex=2/>


You should use jQuery UI's Autocomplete:

http://jqueryui.com/demos/autocomplete/#combobox


If you do not want to use any javascript framework, you can create your own java script code for autocomplete. Please look into the example in this page --> AutoComplete text box autocomplete

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜