Refereing to object dynamically after it is created dynamically


Im sure this is a very silly problem, but im trying to create a li and then set its class in jquery but it doesn’t seam to be working

		var listid = field + "_errormessage";

		if (errorMessage != "")
			$("#errorul").append("<li id='" + listid + "'>" + errorMessage + "</li>");

The variable listid is a string not a DOM element.

$(‘#’ + listid).addClass(‘blue’);