I have an angular ionic cordova app where I’m trying to trigger the click of an input from another span (so that I can trigger the native datetime keyboard in cordova) . However the click event doesn’t seem to be triggered on the input field. Looking at the debugger, the click function of the document element is not null, but doesn’t seem to do anything when triggered from the span. This works on a normal jsfiddle as commenters have noted, but when in an ionic environment, it doesn’t – see this codepen
http://codepen.io/MonkeyBonkey/pen/OPmOrZ
<span onclick="document.getElementById('whenPickerInput').click();"> {{(when | amCalendar)}} </span> <input onclick="alert('input clicked')" id="whenPickerInput" type="datetime-local" ng-model="when" />
Advertisement
Answer
so it looks like ionic has it’s own click handler that removes the 300ms delay in mobile. I have to remove that tap system for the input so that I can trigger the click event
http://ionicframework.com/docs/api/page/tap/
<input data-tap-disabled="true" />