Home > Article > Web Front-end > A simple example of getting the value and text value of select (jquery and javascript)
1、jquery
//获取value值 $("#ddlSubmodel").val(); //获取text值 $("#ddlSubmodel").find("option:selected").text();
2、javascript
//获取value值 document.getElementById("ddlSubmodel").value; //获取text值 var select = document.getElementById("ddlSubmodel"); if (select.selectedIndex > -1) { select.options[select.selectedIndex].innerText; }
The above is this article I hope the content of this article can bring some help to everyone's study or work. If you have any questions, you can leave a message to communicate. I also hope to support the PHP Chinese website!
For more simple examples of obtaining the value and text value of select (jquery and javascript), please pay attention to the PHP Chinese website!