I have a problem with returning "[object HTMLInputElement]", this is my code:
HTML:
<input type="text" id="numb7">
JavaScript:
var numb7 = document.getElementById("numb7").value;
When I alert numb7 it returns:
[object HTMLInputElement]
Can anyone help me?
For the full code: Full Code
I have a problem with returning "[object HTMLInputElement]", this is my code:
HTML:
<input type="text" id="numb7">
JavaScript:
var numb7 = document.getElementById("numb7").value;
When I alert numb7 it returns:
[object HTMLInputElement]
Can anyone help me?
For the full code: Full Code
Share Improve this question edited Jun 29, 2014 at 14:20 user3722860 asked Jun 29, 2014 at 14:04 user3722860user3722860 1891 gold badge3 silver badges11 bronze badges 4- That's not an error. Also, if that's really what your code looks like, that would not happen. – Pointy Commented Jun 29, 2014 at 14:05
-
only omitting
.value
would do that ...alert(document.getElementById("numb7"))
– Alex K. Commented Jun 29, 2014 at 14:07 - 1 I copied and pasted it. It's working properly. Can you post full code. – Mritunjay Commented Jun 29, 2014 at 14:08
- Which browser are you using? – Sherin Mathew Commented Jun 29, 2014 at 14:20
1 Answer
Reset to default 2Perhaps it's an old MSIE patibility feature where all id
and name
attributes are added to the global object. Try giving your variable (or id
) a different name.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745113199a4611968.html
评论列表(0条)