Skip to content

Document element click() method not triggering in ionic angular app

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

<span onclick="document.getElementById('whenPickerInput').click();">
  {{(when | amCalendar)}}

  onclick="alert('input clicked')" 
  ng-model="when" />



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

<input data-tap-disabled="true" />