2016-04-12 26 views
-1

我正在尋找一種方法來爲輸入製作模板值。輸入中的靜態文本

我有這個輸入: 「。。ST B1號恩皮瓣」

input

我想爲靜態值,不能在輸入中更改,用戶只能在(紅色)之間寫入。 之後,我需要整個字符串(「st。7th Ave No.86 bl.34 ...」),所以「做出幾個輸入」不是一個主意。

預先感謝您。

+5

你爲什麼不得到幾個輸入整個字符串?你知道你可以連接字符串嗎? –

+0

@DenysSéguret這是一個要求。 –

+3

你看過jquery的屏蔽輸入嗎? http://digitalbush.com/projects/masked-input-plugin/ –

回答

0

你可以創建自己的自定義輸入,使它看起來像你想要的,然後連接它們在你的代碼中。
作爲一個例子:http://jsfiddle.net/3h9zmxk3/3/

<div class="input-container"> 
<span class="fix-text">St.</span><input type="text" class="my-input"> 
<span class="fix-text">No.</span><input type="text" class="my-input"> 
<span class="fix-text">bl.</span><input type="text" class="my-input"> 
<span class="fix-text">en.</span><input type="text" class="my-input"> 
<span class="fix-text">fl.</span><input type="text" class="my-input"> 
<span class="fix-text">ap.</span><input type="text" class="my-input"> 
</div>