2016-03-04 97 views
0

我有以下form數字輸入字段中的兩位數佔位符

<form> 
 
    <span> 
 
     <input type="number" name="amount_in_dollars" id="amount_in_dollars" value="0" min="0" /> 
 
     </span>. 
 
    <span> 
 
     <input type="number" name="amount_in_cents" id="amount_in_cents" value="00" min="0" max="99" placeholder="00" /> 
 
     </span> 
 
    <input type="submit" value="Submit" /> 
 
</form>

amount_in_cents領域我想有默認值00

注意:placeholder似乎沒有在number領域工作,但有一種方法可以讓我完成我想要的任務嗎?

+0

對我來說工作正常/在瀏覽器上瀏覽器/你想讓我發佈html嗎? –

回答

1

你不需要有value,因爲你正在使用placeholder,你必須在添加placeholder你的第一個input雖然

<form> 
 
    <span> 
 
    <input type="number" name="amount_in_dollars" id="amount_in_dollars" min="0" placeholder="0" /> 
 
    </span> 
 
    <span> 
 
    <input type="number" name="amount_in_cents" id="amount_in_cents" min="0" max="99" placeholder="00" /> 
 
    </span> 
 
    <input type="submit" value="Submit" /> 
 
</form>