js知识:
1、设置select option选中的值:
$("#keywordCatId").val(2); //2为option中对应的value值
2、动态添加select下的option,
var name=cats[cat].keywordCatName;
var value=cats[cat].keywordCatId;
var opp = new Option(name,value);
console.log("loadCat name:"+name+" ,id="+value);
$("#keywordCatId").append(opp);
3、动态添加checkbox元素
checkbox = "<input type='checkbox' value='"+id+"' name='appId'/>"+name;
$("#appcheckbox").append(checkbox)
4、each 用法
$('input[name=level]').each(function(index, value) { });
5、ajax请求
jQuery.ajax({
type : 'POST',
url : act_url + "/getRules",
data:{},
dataType : 'json',
success : function(data) {
var result = eval("(" + data + ")");
console.log("getRules="+result);
loadrule(result);
}
});
6、勾选checkbox选项
$(this).attr("checked", true);
7、问题:
1、jsp页面,请求的路径怎么设置的?
8、获取input标签,name= feature的所有对象
$('input[name=feature]').each(function(index, value) {
var feat = $(this).val();
console.log("feat:"+feat+" ,");
if (feat == feature) {
$(this).attr("checked", true);
}
});
9、获取指定条件下的option,
$("#listruleId").find("option[value='"+rule_hidden+"']").attr("selected",true);
10、页面跳转
window.location.href="?appId=" + appId;
11、刷新页面
location.reload()
12、遍历数组
$.each(dataArray,function(name,value){
});
13、页面跳转
location.href="http://www.baidu.com";
14、全部勾选和取消勾选
$("#all").click(function(){
if($("#all").attr("checked") == "checked"){
$("input[name='check']").attr("checked","checked");
}else{
$("input[name='check']").removeAttr("checked","checked");
}
});
1、设置select option选中的值:
$("#keywordCatId").val(2); //2为option中对应的value值
2、动态添加select下的option,
var name=cats[cat].keywordCatName;
var value=cats[cat].keywordCatId;
var opp = new Option(name,value);
console.log("loadCat name:"+name+" ,id="+value);
$("#keywordCatId").append(opp);
3、动态添加checkbox元素
checkbox = "<input type='checkbox' value='"+id+"' name='appId'/>"+name;
$("#appcheckbox").append(checkbox)
4、each 用法
$('input[name=level]').each(function(index, value) { });
5、ajax请求
jQuery.ajax({
type : 'POST',
url : act_url + "/getRules",
data:{},
dataType : 'json',
success : function(data) {
var result = eval("(" + data + ")");
console.log("getRules="+result);
loadrule(result);
}
});
6、勾选checkbox选项
$(this).attr("checked", true);
7、问题:
1、jsp页面,请求的路径怎么设置的?
8、获取input标签,name= feature的所有对象
$('input[name=feature]').each(function(index, value) {
var feat = $(this).val();
console.log("feat:"+feat+" ,");
if (feat == feature) {
$(this).attr("checked", true);
}
});
9、获取指定条件下的option,
$("#listruleId").find("option[value='"+rule_hidden+"']").attr("selected",true);
10、页面跳转
window.location.href="?appId=" + appId;
11、刷新页面
location.reload()
12、遍历数组
$.each(dataArray,function(name,value){
});
13、页面跳转
location.href="http://www.baidu.com";
14、全部勾选和取消勾选
$("#all").click(function(){
if($("#all").attr("checked") == "checked"){
$("input[name='check']").attr("checked","checked");
}else{
$("input[name='check']").removeAttr("checked","checked");
}
});