Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Kyle Papili
9,112 PointsJquery .change() is not working and I have no clue why!
I have the following HTML & Jquery code....
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<div class= "homepageSelectMenuGroup">
<select class = "homepageSelectors , hpSelectorMenu" id = "classSelector" name="classSelector">
<option value= "science.html" selected>Science Class</option>
<option value= "math.html">Math Class</option>
</select>
</div>
<script>
console.log("The script is working");
$( "#classSelector" ).change(function() {
alert( "Handler for .change() called." );
console.log("But this function will not run!!!");
});
</script>
</html>
For some reason, even when the drop down menu selected item is changed, the function under the .change() will not run. Please help me, thank you very much!!!
1 Answer

Chyno Deluxe
16,936 PointsYou have spaces between your class tag and Id tags
Kyle Papili
9,112 PointsKyle Papili
9,112 PointsThank you very much for the help. I have since figured out another bug in a part of my HTML file that I did not include in the post not thinking it would affect the script. But thank you anyway for the help!!!!!