0
我似乎對HTML5佔位符有一個奇怪的問題。 即時通訊使用下拉菜單來顯示/隱藏div和一個div內我有幾個文本字段對所有IE瀏覽器的HTML5佔位符問題
當我從下拉選擇其中一個選項來顯示div時,div顯示出來但佔位符不是在文本字段中。
任何幫助,將不勝感激。
<script type='text/javascript'>
$(document).ready(function(){
$("#customertype").change(function() {
if ($("#customertype option[value='new']").attr('selected')) {
$('#newcustomer').show();
}
if ($("#customertype option[value='existingcustomer']").attr('selected')) {
$('#newcustomer').hide();
$('#existingcustomer').show();
}
});
});
</script>
<!--Start New Customer -->
<div id="newcustomer" style="display:none;">
<div id="field"> <span id="sprytextfield5">
<input class="input address" type="text" name="address" placeholder="Enter Mailing Address" id="address" />
</span> <span id="sprytextfield6">
<input class="input" type="text" name="city" placeholder="Enter City" id="city" />
</span> <span id="sprytextfield7">
<input class="input" type="text" name="province" placeholder="Enter Province" id="province" />
</span> <span id="sprytextfield8">
<input class="input" type="text" name="postalcode" placeholder="Enter Postal Code" id="postalcode" />
</span> </div>
</div>
<!--End New Customer -->
嘿感謝您的答覆,但當值被添加到字段時,它不會驗證我的來源。 – jheul
您可以使用required屬性來驗證表單,如下所示: – prembaranwal