0 %

How to use HTML 5 Form Validation on Contact Form 7 Plugin ?

How to use HTML 5 Form Validation on Contact Form 7 Plugin ?

By default, the contact form 7 plugin uses ajax validation to check the form entries. You can instantaneously validate some common fields like email, text for blank or invalid entries by adding required attribute to the form.

Just add the below JQuery code to use HTML 5 Form Validation on Contact Form 7 Plugin.

<script>

jQuery(document).ready(function(jQuery){

jQuery(".wpcf7-form-control").prop('required',true);

jQuery(".wpcf7-form").removeAttr('novalidate');

});

</script>

The third line in the code is for fields. You can change the class to target specific field type.
Let me know your thoughts and suggestions.

Việt Lâm Coder

Việt Lâm Coder

Senior Fullstack & System Architect

Cần hỗ trợ website? Gọi / Zalo 0944.71.4545.

Trao đổi về dự án của bạn!

VietLamCoder CMS — Nền Tảng Quản Trị Flat-File Siêu Tốc LamWeb.com.vn — Hệ Sinh Thái Thiết Kế Web & Kho Giao Diện 2026