Is there a way to select all date inputs?
I have:
<input type="date" name="bday">
all i need it's just to select all inputs.
there are many selectors, but nothing like:
$('input:date')
this approach
$("input[type='date']")
looks no good
What's the best practice?
If you want something cross browser, you should stick with:
$('input[type="date"]')
I don't think you can select all inputs of type date in a different way. If however you want to select all text fields you can go with
$(':text')
or if you want all radios you can go with
$(':radio')
The cleanest way is to add a class "date" to all your input and select them with $('.yourClass')
.
If you can't add class, i don't see why $("input[type='date']")
"look no good".
Maybe you want something like $('input').filter('[type=date]')
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With