more and more programmers are using ajax for their web applications. one of the favorite frameworks to use is Jquery - its an awesome FREE tool to use as your javascript framework.

so there i was debugging my script then all of the sudden it changed my cod to another website and it didnt work. looking at the firefox developer's tools, i see the error says: uncaught exception: Syntax error, unrecognized expression: #

i spent a while trying to figure out what it means..

if you are getting this error on your javascript using jquery or any other jquery pluggin, it is because the element does not exists in your HMLT page (DOM)

ok, let me give you an example, i had this code on my javascript file:

	$('[RDACS]').livequery( function(){	
		$(this).each(function() {
			var ChildId = '#'+$(this).attr('id');
			var ChildArray = $(this).attr('RDACSids').split("|");
			var ChildLen = ChildArray.length;
			for(i=0; i< ChildLen; i++) {
				$('#'+ChildArray[i]).appendTo(Child);
				$('#'+ChildArray[i]).addClass("ReplyToTopic"); 
			}
		});
	});
on the code above i was getting the error on this line: $('#'+ChildArray[i]).appendTo(Child); so i chaged it to this:
	$('[RDACS]').livequery( function(){	

			var ChildId = '#'+$(this).attr('id');
			var ChildArray = $(this).attr('RDACSids').split("|");
			var ChildLen = ChildArray.length;
			for(i=0; i< ChildLen; i++) {
				if(ChildArray[i]){
					$('#'+ChildArray[i]).appendTo(Child);
					$('#'+ChildArray[i]).addClass("ReplyToTopic");
				}
			}

	});


so basically i added this if(ChildArray[i]){ which checks if the array element on my loop has a value, if its empty or false, skip the appendTo()

hope that helps