javascript - object HTMLInputElement error with .value - Stack Overflow

I have a problem with returning "[object HTMLInputElement]", this is my code:HTML:<input

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
Add a ment  | 

1 Answer 1

Reset to default 2

Perhaps 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

相关推荐

  • javascript - object HTMLInputElement error with .value - Stack Overflow

    I have a problem with returning "[object HTMLInputElement]", this is my code:HTML:<input

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信