常见的表单元素选中

 一:获取select赋值

<select class="sel-ul-add" id="xuanzhe">

<option>A</option>

<option>B</option>

</select>

赋值方法

 $("#xuanzhe option:selected").text(C);

 

二:redio元素的选中

点击汉字即可以选中,但是后边的一定是label标签才行
<input type="radio" name="shouji " id="p1" /> <label for="p1" style="cursor: pointer">苹果</label> <input type="radio" name="shouji " id="p2" /> <label for="p2" style="cursor: pointer">华为</label>
选中赋值
$("#id").prop("checked",true)
判断是否选中

var p1 = $("#p1").is(":checked");
var p2 = $("#p2").is(":checked");

 

posted @ 2015-08-10 14:30  逍遥帝君  阅读(294)  评论(0编辑  收藏  举报