English 中文(简体)
获取 jQuery 对象下的数组的值
原标题:Getting value from array under jQuery object

最后,我突然不得不调试一些 jQuery 。 这并不是我的专业领域。 当前脚本正在寻找一个由 jQuery 提供的文本框中的值, 而该文本框是 JQuery 提供的, 失败了 。

查看铬中的 DOM 时, 我可以看到此元素在下面有一个“ 来源日期” 元素。 变量浏览器将此元素列为类型 jQuery. fn.jQuery.init[1] 。 它包含元素 0: HTML InputEplement, 上下文: HTMLDocument, 长度:1 和一些其它东西 。

值 I m 之后的值在 0 对象中, 但我似乎找不到要找到的语法 。 只要我能将jQuery 构建事物的语法作为数组来表示, 但只能做 < code> 。 从Date[0] 或 开始。 从Date(0) 开始。 从Date.0 全部 产生错误, “ 对象目录的属性不是函数 ” 。

我如何得到我的价值?

最佳回答

您的变量是一个 jQuery 对象 。

进入其中所含(第一次和唯一一次)DOM单元,使用:

myObject[0]

myObject.get(0)

如果您只想获得 HTMLInputEplement 的值, 您可以使用 :

myObject.val()
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签