feeela
feeela

Reputation: 29932

clear datetime-input in Opera via JS

I'd like to use the new HTML5 form-input-types like datetime and additionally offer an button to insert the current date and time as well a second button to clear that input. All of this works fine with the current solution. But Opera presents a very peculiar datetime-input, which I can't clear, using $(inputElement).val(''); to empty the value (using jQuery). Though this works with recent versions of Chromium (which has a simpler datetime-picker) and Firefox (which has no datetime-picker at all).

Has anyone a hint for me, on how to clear that input-field in Opera browser?

Upvotes: 0

Views: 349

Answers (2)

Gabriel Hautclocq
Gabriel Hautclocq

Reputation: 3320

I got some result by changing the .valueAsNumber property of the datetime input field instead of the .value property, but I also can't reset it to its initial state.

Upvotes: 0

tagawa
tagawa

Reputation: 4611

You're right - it looks like this is not possible at the moment. It seems to be the "time" part of the datetime input that's causing the problem. I've created a bug report so hopefully this will be addressed in a future version.

Upvotes: 1

Related Questions