Project

General

Profile

« Previous | Next » 

Revision 5789

search criteria:
-ensure search criteria ids are unique
-add click listener to Remove button only

View differences:

index.jsp
409 409
	var count = $("#searchCriteria").children(".searchItem").length;
410 410
	count++;
411 411
	var containerId = "searchItem_" + count;
412
	// ensure the containerId is unique
413
	while ($("#" + containerId).length > 0) {
414
		count++;
415
		containerId = "searchItem_" + count;
416
	}
412 417
	var container = "<div class='searchItem' id='" + containerId + "'/>";
413 418
	$("#searchCriteria").append(container);
414 419
	
......
432 437
	});
433 438
	
434 439
	// add the remove button
435
	$("#" + containerId).append("<input type='button' value='Remove'/>").click(function() {
440
	var removeButtonId = containerId + "_remove";
441
	$("#" + containerId).append("<input type='button' value='Remove' id='" + removeButtonId + "'/>");
442
	$("#" + removeButtonId).click(function() {
436 443
		// remove the container (includes the form objects we added)
437 444
		$("#" + containerId).remove();
438 445
		// refresh the search results now that they are less restrictive

Also available in: Unified diff