var selectedEmployeeIds = "";
var selectedEmployeeNames = "";
$(".jemployee_data").click(function(){
//$(this).find("td:first").html()+",";
var curEmployeeId = $(this).children().eq(0).html()+",";
var curEmployeeName = $(this).children().eq(2).html()+",";
if ($(this).hasClass("jemployee_selected")){
$(this).removeClass("jemployee_selected");
selectedEmployeeIds.replace(curEmployeeId, "");
selectedEmployeeNames.replace(curEmployeeName, "");
selectedEmployeeCount--;
}else{
$(this).addClass("jemployee_selected");
selectedEmployeeIds += curEmployeeId;
selectedEmployeeNames += curEmployeeName;
selectedEmployeeCount++;
}
为什么我替换死活都替换不了, curEmployeeId和curEmployeeName值跟踪了,是有的,而且selectedEmployeeIds和selectedEmployeeNames值里面是包含了要替换的值,就是替换不了。。没有反应。。不知道什么原因, 大侠指点一下。。谢谢。
selectedEmployeeIds.replace(curEmployeeId, "");
selectedEmployeeNames.replace(curEmployeeName, "");
selectedEmployeeIds=selectedEmployeeIds.replace(curEmployeeId, "");
selectedEmployeeNames=selectedEmployeeNames.replace(curEmployeeName, "");
你只是替换,没有更新原来的变量值了。。