我遇到了 Jquery 验证和 html5 占位符的问题。它在 chrome 和 FF 中运行良好,但在 IE 9 及以下版本中我遇到了问题。我只在我先点击提交时才看到问题。
在文本字段中键入时,每个必填且具有占位符文本的字段都不会消失
http://screencast.com/t/R0hqbXKm
这是我在标题中的代码
<script type="text/javascript">
$(document).ready(function () {
//Start code
// end code
// Updated
$('#form339').validate({ // initialize the plugin
rules: {
firstName: {
required: true
},
lastName: {
required: true
},
Company: {
required: true
},
EmailAddress: {
required: true,
email: true
}
}
});
});
</script>
<script src="/js/microsite/html5placeholder.jquery.js"></script>
<script>
$(function(){
$(':input[placeholder]').placeholder();
});
</script>
正文中的代码
<fm action="#" method="post" name="f1">
<input name="elqFormName" type="hidden" value="####" />
<input name="elqSiteId" type="hidden" value="1363" />
<input name="elqCampaignId" type="hidden" />
<input name="sfdc_campaign" type="hidden" value="701D0000000auNz" />
<input name="lead_request" type="hidden" value="000" />
<input name="lead_source" type="hidden" value="2013-Rebrand" />
<input name="Salutation1" placeholder="*Prefix" type="text" />
<input name="firstName" placeholder="*First Name" type="text" />
<input name="lastName" placeholder="*Last Name" type="text" />
<input name="EmailAddress" placeholder="*Email Address" type="text" />
<input name="Company" placeholder="*Company" type="text" />
<input name="HQ_State1" placeholder="HQ State/Province" type="text" />
<!--<input type="text" placeholder="Phone Number" name="phone">-->
<br />
<select class="drop1" name="country">
<option selected="selected" value="">Country</option>
<option value="Afghanistan">Afghanistan</option>
<option value="United States">United States</option>
<option value="CA">CA</option></select>
<!--<div class="requiredtxt">* Required fields</div>-->
<input alt="SUBMIT!" border="0" class="submit_style" height="29" src="/images/general/Submit2.png" type="image" width="252" />
</form>
我该如何解决这个问题