文本框操作
取 值:var textval = $("#text_id").attr("value");
var textval = $("#text_id").val();
清除内容:$(”#txt”).attr(”value”,”);
填充内容:$(”#txt”).attr(”value”,’123′);
文本域操作
取 值:var textval = $("#text_id").attr("value");
var textval = $("#text_id").val();
清除内容:$(”#txt”).attr(”value”,”);
填充内容:$(”#txt”).attr(”value”,’123′);
单选按钮操作
取 值:var valradio = $("input[@type=radio][@checked]").val(); //只有一组Radio情况下
var valradio =$('input[@name=chart][@checked]').val(); //多组Radio情况下,根据name取一组的值
下拉框操作
取 值:var selectval = $('#sell').val();
设置选中:$("#select_id").attr("value",'test');//设置value=test的项目为当前选中项
添加新项:$("<option value='test'>test</option><option value='test2'>test2</option>").appendTo("#select_id")//添加下拉框的option
清空下拉框:$("#select_id").empty();//清空下拉框
多选框操作
取 值:$("#chk_id").attr("checked",'');//未选中的值
$("#chk_id").attr("checked",true);//选中的值
if($("#chk_id").attr('checked')==undefined) //判断是否已经选中
08-23
02-28
02-28
06-03
02-11
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交