effeffe
effeffe

Reputation: 99

how to clear input type="datetime" via javascript

I've a problem trying to clear with javascript a form with an input of type="datetime"

because the following code doesen't work when i add input:datetime

$form.find('input:text, input:password, input:file, select, textarea').val('');

Can you help me?

Thank you very much!

Upvotes: 3

Views: 5049

Answers (2)

Icarus
Icarus

Reputation: 63956

You would have to use this selector instead:

$('input[type="datetime"]').val('');

Since jQuery as of v1.10 does not recognize input:datetime as a valid selector.

See this fiddle

Upvotes: 3

Adam Wolski
Adam Wolski

Reputation: 5656

You can use input[type=datetime] selector instead.

$form.find('input[type=datetime]').val('');

jsFiddle

Upvotes: 4

Related Questions