dropdownlist select的用法

<tr>
        <td></td>
        <td>@Html.DropDownList("ddlSex",@Model.SList)</td>
    </tr>
      <tr>
        <td></td>
        <td>@Html.DropDownList("ddlCity",@Model.CityList)</td>
    </tr>
    <tr><td>
           <input id="btnTestSelect" type="button" value="TestSelector"  onclick="TestJquery()"/>
        </td>
        <td></td>
    </tr>

 

   function TestJquery()
    {

        alert($("#ddlSex option:selected").text());
        alert($("#ddlSex").find("option:selected").text());
       $("select option:selected").each(function () {
           alert($(this).text());
       })


  }

posted on 2018-03-09 12:10  sxjljj  阅读(178)  评论(0编辑  收藏  举报