$(".jsPwd").on('input propertychange', function() { //事件监听 $(".jsPlaceholder")[$(this).val() != '' ? 'hide' : 'show'](); }); window.addEventListener('pageshow', function(event) { //处理后退问题 setTimeout(function() { var jsPwd = $(".jsPwd").val(); if (jsPwd && jsPwd.trim() != '') { $(".jsPlaceholder").hide(); } else { $(".jsPlaceholder").show(); } }, 101); });