获取chechbox选中id
<input id="btnCheckAll" class='checkbox' type="checkbox" name="allList" style="color:#FFF" /> //全选
<input class='checkbox' type=\"checkbox\" name='eachList' id='btnCheckEach' value='"+val.id+"'> //单选
1.全部选中和清空
$("#btnCheckAll").click(function(){
if($("#btnCheckAll").prop("checked") == true){
$("input[name='eachList']").prop("checked", true);
console.log(1);
}else{
$("input[name='eachList']").prop("checked", false);
console.log(2);
}
2.获取单选的选中项
var id_array=$('input[name="eachList"]:checked')
var templateIds = new Array();
for(var i = 0; i < id_array.length; i++){
if(id_array[i].checked)
templateIds.push(id_array[i].value);
}
//alert(templateIds.toString());
var all=document.getElementById("btnCheckAll").checked
var each=document.getElementById("btnCheckAll").checked
var check=document.getElementById("check").checked
alert(all);
如果选中了相应box 弹出true,否则false
穿插一点后台字符串替换
str1 = str1.replaceAll("'","''");
str1 = str1.replaceAll( "\\\\", "\\\\\\\\");
//替换空格
str1 = str1.trim();
str1 = str1.replaceAll("(?i)</textarea>", "</textarea>")
//增加外引号
str1 = "'" + str1+"'";
html原样输出
<textarea></textarea>
<pre></pre>