Example:
Zhang San Li Si < /select> //Get the currently selected option value $('#sltList').val() //Get the text of the currently selected item $('#sltList option[@ selected]').text(); // Get the currently selected option, text is the text, and val is the value of the option or var item = $("select[@name= list] option[@selected] ").text(); //Set the text to the currently selected item $("#sltList option[@selected]").attr("text",'张三'); //Set the second element of the select drop-down box to the currently selected value $('#sltList')[0].selectedIndex = 1; //Set the item with value=1 to the currently selected item $("#sltList").attr("value",'1'); $('#sltList').val('1'); //Add the option of the drop-down box $("Wang Wu Zhao Liu ").appendTo("#sltList") //Empty the drop-down box $("sltList").empty(); Example: //Events when changing $("#testSelect").change(function (){ //Event occurred jQuery('option:selected', this).each(function(){ //Print out multiple selected values alert(this.value); } ); }); $("#childTypeResult").append(htmlStr); //Add the value of htmlStr after this ID tag. $("#childTypeResult").html( htmlStr); is to modify the value of this ID to the value of htmlStr.
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