(030)jquery_表单选择器selected
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>form_selected.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <style type="text/css"> select { width:120px; height:100px; } </style> <script type="text/javascript" src="../js/jquery/jquery190.js"></script> <script type="text/javascript"> $(document).ready(function(){ var value = $("#frmTest :selected").text(); $("#mydiv").text(value); }); </script> </head> <body> <h3>获取处于选中状态元素的内容</h3> <form id="frmTest" action="#"> <select id="Select1" multiple="multiple"> <option value="0">苹果</option> <option value="1" selected="selected">桔子</option> <option value="2">荔枝</option> <option value="3" selected="selected">葡萄</option> <option value="4">香蕉</option> </select><br /><br /> <div id="tip"></div> </form> <div id="mydiv"></div> </body> </html>
***万事万物都有裂痕,那是光照进来的地方***

浙公网安备 33010602011771号