Home  >  Article  >  Web Front-end  >  jquery select(列表)的操作(取值/赋值)_jquery

jquery select(列表)的操作(取值/赋值)_jquery

WBOY
WBOYOriginal
2016-05-16 18:09:16803browse

1.获取选中值: $("#xmzt option:selected").val() //xmzt是的index从0开始,所以1是第二项

很奇怪的是,我是用id来获取的,应该是唯一值,但$("select[@id='pagesize_slt']").selectedIndex = 1;是不对的。必须加[0]。也就是说,$("select[@id='pagesize_slt']")返回的其实是一个数组。这点需要注意。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn