I am trying to use jQuery to select all the inputs in my form that have a data attribute with a similar name.
This is my form:
<form id = "myForm"> <input name="name" data-valid-presence=true > <input name="age" data-valid-biggerThan="18" > <input name="email[0]" data-valid-email=true > <input name="email[1]" data-valid-email=true > </form>
and my jQuery selector:
var inputs = jQuery("#myForm").find("input[data-valid-email],[data-valid-length],[data-valid-presence], [data-valid-biggerThan]");
I am looking for a way to select all the inputs that have data-valid-* in them without finding them one by one like this.
Any ideas?
source share