Fixed JavaScript error caused by CSS selector