I'm trying to capture a paste event for an input[type="date"]
element. In Chrome you cannot copy/paste into this type of element, so as a workaround I am trying to wrap it in a DIV
element with an onpaste
event. The issue I'm encountering is that if you click the date input and press CTRL+V nothing happens. However, if you click anywhere else in the body first and then click the date input and press CTRL+V, it works...
<div onpaste="alert('test')">
<input type="date">
</div>
Demo:
https://jsfiddle.net/4qh31tn0/
EDIT: OK, so it turns out that the onpaste
event doesn't have to be on the DIV
, it can be moved to the INPUT
element, but the problem persists. If I load the jsfiddle, click the input and press CTRL+V, nothing happens. If I click someplace outside of the INPUT
element beforehand then click the input and press CTRL+V, it works...