How to get the required value of all input tags that contain the required attribute

  •                     <label class="name">:</label>
                        <input name="" type="text" class="text_Add" required pattern="(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$" />
                        <span class="form_hint">11</span>
                    </li>
                    <li>
                        <label class="name">:</label>
                        <input name="" type="text" class="text_Add" required pattern="^[\u4e00-\u9fff\w]{5,16}$" />
                        <span class="focus-input100"></span>
                        <span class="form_hint">5-16</span>
                    </li>
                    <li>
                        <label class="name">:</label>
                        <input name="" id="passwd" type="password" class="text_Add"  required pattern="(\w){6,20}" />
                        <span class="form_hint"> 6-20</span>
                    </li>
                    

    I don"t want to get it one by one, because if there are 10, I have to write 10 lines of code to get, which is not efficient.

  • Mar.10,2021

    . Then you add a unified and unique class to all input with required attribute, get the dom, through the class and then loop through the dom array to get the value.

    Menu