我們在用到下拉列表框select時,需要對選中的<option>選項觸發事件,其實<option>本身沒有觸發事件方法,我們只有在select里的 onchange方法里觸發。
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <select id="pid" onchange="gradeChange()"> <option value="北京">北京</option> <option value="上海">上海</option> </select> <script src="jquery-1.11.1.min.js"></script> <script type="text/javascript"> function gradeChange(){ var checkText=$("#pid").find("option:selected").text(); alert(checkText); } </script> </body> </html>