I create a new form in wp header using function wp_login_form(), but form fields are not set required attribute. How to add required to field?

  • You can use javascript for enforcing required validation.
    – BlueSuiter
    Commented Mar 3, 2018 at 7:59
  • yes its done! using $("#user_login").attr({"placeholder" : "User Name", "required": "required"}); similarly for password field. Commented Mar 3, 2018 at 8:53

1 Answer 1

$("#user_login").attr({"placeholder" : "User Name", "required": "required"});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.