要求隐藏字段 [英] make hidden field required
本文介绍了要求隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
<label for="uploadFile" class="custom-uploadFile">
<i class="fa fa-cloud-upload"></i> UPLOAD ID
</label>
<input class="form-control input-lg" name="picture" id="uploadFile" type="file" style="display:none;" required>
我想让此上传字段为必填字段,但输入为隐藏. 我必须使用一些javascript或解决该问题的方法,因为我看了很多tuto,但没有用! 谢谢
I WANT the let this field of upload required but the input is hidden . i must use some javascript or what to solve this problem because i watched a lot of tuto but not work ! Thank you
推荐答案
如果要查看表单验证消息,可以使用不透明度隐藏输入.
If you want to see the form validation message you can hide the input using opacity.
#uploadFile {
opacity: 0;
width: 0;
float: left; /* Reposition so the validation message shows over the label */
}
div {
text-align: center;
}
<form>
<input name="picture" id="uploadFile" type="file" required>
<label for="uploadFile">Upload label</label>
<div><input name="submit" type="submit"></div>
</form>
这篇关于要求隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文