Web Development Blog

jQuery Input Type Selectors for HTML5

As many of you have noticed,  jQuery doesn’t allow you to select HTML 5 input elements with the standard colon selection type, like this :date

So what you can do is use brackets to define the input type you want to select. Here is what I came up with. This should include most if not all HTML5 input types.

$(':text, [type=date], [type=time], [type=search] ,[type=number] ,[type=email] ,[type=datetime] ,[type=datetime-local] ,[type=month] ,[type=week] ,[type=time] ,[type=tel] ,[type=url] ,[type=color] ,[type=range]').each(function()

 {

  // add what you want to do here

 });

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Request A Free Quote

GET OUR PRICING GUIDE

Enter your email address below, and we'll send you our current pricing guide immediately.