javascript - How to check Aria-Invalid in an Input Form - Stack Overflow

How can you check the value of aria-invalid in an input form?Here's my input field and the value o

How can you check the value of aria-invalid in an input form?

Here's my input field and the value of aria-invalid is false:

<input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" id="contact-email" aria-required="true" aria-invalid="false" placeholder="Email *">

I need to identify the aria-invalid if it's true or false. Here's my javascript for identifying this and I'm having a difficulty

<script>
$(document).ready(function(){
    var input_email = document.getElementById("contact-email");

});

Help with this please thanks!

How can you check the value of aria-invalid in an input form?

Here's my input field and the value of aria-invalid is false:

<input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" id="contact-email" aria-required="true" aria-invalid="false" placeholder="Email *">

I need to identify the aria-invalid if it's true or false. Here's my javascript for identifying this and I'm having a difficulty

<script>
$(document).ready(function(){
    var input_email = document.getElementById("contact-email");

});

Help with this please thanks!

Share Improve this question asked May 16, 2018 at 1:03 Jae EunJae Eun 573 silver badges15 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

Use getAttribute() to get the value of attributes, in your case aria-invalid

document.getElementById("contact-email").getAttribute("aria-invalid")

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745262011a4619252.html

相关推荐

  • javascript - How to check Aria-Invalid in an Input Form - Stack Overflow

    How can you check the value of aria-invalid in an input form?Here's my input field and the value o

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信