question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The DOM element is not valid, [object HTMLInputElement] given.

See original GitHub issue

Expected behavior

Trying to initialize autoNumeric as per examples in readme: new AutoNumeric('.myInput');

Actual behavior

Error: The DOM element is not valid, [object HTMLInputElement] given.

Steps to reproduce the problem

  1. Using autoNumeric <v4.0.3> and the browser <Firefox> version <57.0.1> on <Linux>,
  2. I used no options
  3. Initialized my AutoNumeric object with the call <new AutoNumeric(domElement)>,
  4. Error: The DOM element is not valid, [object HTMLInputElement] given.

By looking at the source I can see that the checkElement is only checking domElement typeof Element when for some reason the string myInput passed to AutoNumeric results in HTMLInputElement object.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexandreBonneaucommented, Dec 8, 2017

Well, if you can’t reproduce the ‘bug’, then I cannot fix it if it indeed from AutoNumeric!

See, I created a very simple test case here, and do not see the problem neither with Firefox 58.0b9, 58.0b10, 56.0b12 nor 52.5.0, with the stable or next AutoNumeric versions.

I’m therefore closing this as invalid. If you feel you can add more data so we can reproduce (and fix eventually) this, then feel free to reopen that issue.

Lastly, HTMLInputElement is subclassing Element, so your instanceof test must be wrong somewhere, see in the codepen:

console.log('Element: ', inputNode instanceof Element); // true
console.log('HTMLInputElement: ', inputNode instanceof HTMLInputElement); // true
0reactions
AlexandreBonneaucommented, Dec 10, 2017

Any time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript, viewing [object HTMLInputElement] - Stack Overflow
You just try to run my code. It will work fine but as you put an [id="amt"](without square brackets) (which is a variable...
Read more >
HTMLInputElement - Web APIs | MDN
Chrome Edge HTMLInputElement Full support. Chrome1. Toggle history Full support. Edge12. Toggle hist... accept Full support. Chrome1. Toggle history Full support. Edge12. Toggle hist... align. Deprecated...
Read more >
Documentation - DOM Manipulation - TypeScript
The Document Object Model (DOM) is a programming interface implemented by ... Some elements do not exhibit unique properties and so they just...
Read more >
Node properties: type, tag and contents
For example, let's consider the DOM object for an <input> element. It belongs to HTMLInputElement class. It gets properties and methods as a ......
Read more >
DOM Elements - React
If you set suppressHydrationWarning to true , React will not warn you about mismatches in the attributes and the content of that element....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found