in relation to an already asked question here
But that question never got answered.
I am trying to addEventListener on an iron-form like:
my HTML imports:
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="/bower_components/iron-form/iron-form.html">
<link rel="import" href="/bower_components/paper-input/paper-input.html">
<link rel="import" href="/bower_components/paper-button/paper-button.html">
<link rel="import" href="/bower_components/paper-spinner/paper-spinner.html">
the form:
<form is="iron-form" method="get" action="/" id="eventsDemo">
<paper-input name="name" label="Name" required auto-validate></paper-input>
<paper-input name="password" label="Password" type="password" required auto-validate></paper-input>
<paper-checkbox name="read" required>You must check this box</paper-checkbox>
<br>
<paper-button raised onclick="_delayedSubmit(event)" disabled id="eventsDemoSubmit">
<paper-spinner id="spinner" hidden></paper-spinner>
Submit
</paper-button>
<paper-button raised onclick="_reset(event)">Reset</paper-button>
<div class="output"></div>
</form>
and the listener:
document.getElementById('eventsDemo').addEventListener('iron-form-submit', function (event) {
});
But that gets me the error aswell -
Uncaught TypeError: Cannot read property 'addEventListener' of null
I already tried some suggestions with window.onload, or WebComponentsReady. Nothing helped.
Maybe you're missing a } or bower install