The DOM element is not valid, [object HTMLInputElement] given.
See original GitHub issueExpected 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
- Using autoNumeric
<v4.0.3>
and the browser<Firefox>
version<57.0.1>
on<Linux>
, - I used no options
- Initialized my AutoNumeric object with the call
<new AutoNumeric(domElement)>
, 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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
nor52.5.0
, with the stable ornext
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 subclassingElement
, so yourinstanceof
test must be wrong somewhere, see in the codepen:Any time!