Javascript,查看[object HTMLInputElement] [英] Javascript, viewing [object HTMLInputElement]

查看:780
本文介绍了Javascript,查看[object HTMLInputElement]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始学习HTML。在我的一个变量上做一个 alert()给了我这个结果 [object HTMLInputElement]



如何获取在文本字段中添加的数据,其中输入类型是文本?如果你的变量是 myNode ,你可以执行 myNode.value 来检索输入元素的值。

Firebug有一个DOM选项卡,显示有用的DOM属性。



另请参阅mozilla页面参考: https://developer.mozilla.org/en-US/docs/ DOM / HTMLInputElement


I'm just started to learn HTML. Doing an alert() on one of my variables gives me this result [object HTMLInputElement].

How to get the data, that were added in text field, where my input type is text?

解决方案

Say your variable is myNode, you can do myNode.value to retrieve the value of input elements.

Firebug has a "DOM" tab which shows useful DOM attributes.

Also see the mozilla page for a reference: https://developer.mozilla.org/en-US/docs/DOM/HTMLInputElement

这篇关于Javascript,查看[object HTMLInputElement]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆