Home > Web Front-end > JS Tutorial > jquery select (list) operations (value/assignment)_jquery

jquery select (list) operations (value/assignment)_jquery

WBOY
Release: 2016-05-16 18:09:16
Original
880 people have browsed it

1. Get the selected value: $("#xmzt option:selected").val() //xmzt is the id of 's index starts from 0, so 1 is the second item

The strange thing is that I use id The value obtained should be the only value, but $("select[@id='pagesize_slt']").selectedIndex = 1; is incorrect. Must add [0]. In other words, $("select[@id='pagesize_slt']") actually returns an array. This needs attention.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template