2016-02-29 46 views
0

你好,我有一个osclass网站,我做了这个代码需要进行一些自定义字段HTML5自定义属性所需的消息不工作

<script type="text/javascript"> 
     $("#countryId").attr('required', 'required'); 
     $("#regionId").attr('required', 'required'); 
     $("#city").attr('required', 'required'); 
     $("#cityArea").attr('required', 'required'); 
     $("#contactName").attr('required', 'required'); 
     $("#price").attr('required', 'required'); 
</script> 

请帮我更改默认的消息:“请填写此场”

非常感谢您

+1

HTTP的可能重复:// stackoverfl ow.com/questions/25628209/dynamically-change-required-for-html5-input-control – arthurakay

+2

[设置自定义HTML5必填字段验证消息]的可能重复(http://stackoverflow.com/questions/13798313/set-custom -html5-required-field-validation-message) – PeeHaa

回答

0

我认为这将有利于 <input type="text" required title="Custom message" />

+0

只需将title属性添加到输入元素 –

+0

那么您可以像这样通过jQuery使用 –

+0

$('#countryId')。 attr(“标题”,“自定义消息”); –