all i ...">

HTML5 jQuery select all date field fields: date '

Is there a way to select all date entries?
I have:

<input type="date" name="bday"> 

all i need is just select all inputs.
there are many selectors , but nothing like that:

 $('input:date') 

this approach

  $("input[type='date']") 

looks good

What is the best practice?

+7
source share
2 answers

If you need something cross browser, you should stick with:

 $('input[type="date"]') 

I don’t think you can select all date type inputs differently. If you want to select all text fields, you can go with

 $(':text') 

or if you want all the radio stations to be used with

 $(':radio') 
+17
source

The cleanest way is to add the date class to all your entries and select them using $('.yourClass') .

If you cannot add a class, I don’t understand why $("input[type='date']") "doesn’t look good."

Perhaps you want something like $('input').filter('[type=date]') ?

+1
source

All Articles