HTML代碼:輸入[MAX]爲驗證不起作用
<input type='number' name='input_name_here' max='10' placeholder='Enter a number less than 10'>
$('input[max]').each(function()
{
maxValue=$(this).attr("max");
inputValue=$(this).val();
if(inputValue>maxValue)
alert("Please consider the Maximum permited value");
});
但是,這是行不通的。我做對了嗎?
你知道你在做什麼嗎? –
你能告訴我們你的html與這個jquery一起去嗎? – Cyassin
感謝html行。你能解釋什麼不起作用嗎?你可以確認它是否進入循環的警報或什麼? – Cyassin