【发布时间】:2025-12-30 18:10:06
【问题描述】:
我想在我的输入字段中接受URL。但我不在乎https:// 或https://。我只想删除此验证。但它应该只接受URL。
www.example.com 或 example.com 这样的示例应该是可以接受的。
<form action="" method="POST" class="form-box d-flex justify-content-between" enctype="multipart/form-data">
<input type="url" class="form-control" name="url">
<button type="submit" class="btn search-btn">Find</button>
</form>
【问题讨论】:
-
使用html输入
pattern属性,匹配.。这应该是一个网址所必需的。并且没有特殊字符。见:w3schools.com/tags/att_input_pattern.asp -
@gilbert-v 感谢您提供提示
标签: javascript html forms html-input