Hello,

I am currently working on some code that changes html presentation by changing classes identified in my CSS document. I as hoping to use a Core.hasClass() function to ensure that things follow through properly and take additional steps if they are not.

HTML Code:
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US">
<head>
<meta http-equiv="content-type" content="text/css" charset="utf-8" />
<title>Pizza Party!</title>
</head>
<body>
<div class="header">
<h1>Pizza-Pazzaz!</h1>
<p class="tagline">Welcome to the greatest Pizza Parlor in Mt. Kisco!</p>
</div>
<div id="list_1" class="ingredients">
<p>While our Pizzas are exquisite without toppings, our customers often enjoyo a mixture of vegetarian and meat additions.</p>
<h3>Vegetarian option</h3>
	<ul>
		<li>Bell Peppers</li>
		<li>Banana Peppers</li>
		<li>Spinach</li>
		<li>Onions</li>
		<li>Garlic</li>
		<li>Olives</li>
	</ul>
<h3>Meats</h3>
	<ul>
		<li>Meatballs</li>
		<li>Buffalo Chicken</li>
		<li>Grilled Chicken</li>
		<li>BBQ Chicken</li>
		<li>Sausage</li>
	</ul>
</div>
<div id="footer"">
<p class="additional">hi</p>
</div>
<script type="text/javascript">
Code:
Core.hasClass = function(target, theClass) {
var pattern = new RegExp("(^| )" + theClass + "( |$)");
if (pattern.text(target.className) {
return true;
}
return false;
};
var div2=document.getElementById("list_1");
if (Core.hasClass(div2, "ingredients")) {
alert("The second div element has the matching class");
}
HTML Code:
</script>
</body>
</html>

The Core.hasClass I took from Kevin Yank's Simply Javascript book. I'm not entirely sure why this code is not working, but my intention is to throw the Core.hasClass into an external file and reference it similar to the conditional code.