IE8瀏覽器不支持placeholder屬性 提供以下解決方案瀏覽器
function checkPlaceholder(obj) { var value = obj.val(); obj.focus(function() { obj.val(""); }); obj.blur(function() { obj.val(value); }); } jQuery(document).ready(function () { //iE11如下的不支持placeholder屬性 統一賦值 $("input[name=startDate]").val("開始時間"); $("input[name=endDate]").val("結束時間"); $("input[name=hourPeriOdStart]").val("逗留最少時間"); $("input[name=hourPeriOdEnd]").val("逗留最長時間"); checkPlaceholder($("input[name=startDate]")); checkPlaceholder($("input[name=endDate]")); checkPlaceholder($("input[name=hourPeriOdStart]")); checkPlaceholder($("input[name=hourPeriOdEnd]")); )};