English 中文(简体)
设法利用jQuery/javascript获得一个滴水箱的备选办法,但说,选择没有界定?
原标题:Trying to access the options of a dropdown box using jQuery/javascript, but it s saying that .options is undefined?

I html html html html

.append("<br><SELECT  NAME= Month_list  class= month_selection </SELECT>");

它带来了罚款,但我试图通过下列法典积极增加选择:

$( .month_selection:last ).options.add(new Option(month_array[index]));

但是,在大火中发现了以下错误:

$(".month_selection:last").options is undefined

选择人正在做罚款,因为我可以操作以下编码线:<代码>$(......月_selection:last”)和下级盒被拆除,而且从我从各种图章<代码>中可以讲到的是什么。 感谢阅读。

最佳回答

您需要获得<代码><select> DOM 元件,以进入。 类似:

$( .month_selection:last )[0].options
//or...
$( .month_selection ).get(-1).options

您请见

关于电离层扰动特性,您需要首先注意(通过>[0]http://api.jquery.com/get/"rel=“nofollow”>.get(0) in this case)then 进入其特性,否则,你会试图在不存在的饰物上获取财产。

问题回答

暂无回答




相关问题
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.