The first function places a particular list from a hidden div depending on which item is clicked. This function works correctly when clicking the 'a' link. After clicking a link, it will remove the class from all the list and add the new class to the correct list item. It then loads the hidden list into the orange_box div.
The second function is supposed to do something similar, but it is not triggering on click of the secondlist class. When I remove 'a', which I thought was the culprit, nothing happens as either. Is this an issue with the HTML content being placed in another div and therefore can't be targeted?
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<ul id="firstlist" class="no-list-styles inline">
<li class="select1"><a href="#intro">Intro</a></li> |
<li><a href="#1_list">Access to Mental Health</a></li> |
<li><a href="#2_list">Diet & Exercise</a> |
</li><li><a href="#3_list">Tobacco Use</a></li>
</ul>
<div class="hide" id="firstlistmenu">
<div id="1_list">
<ul class="no-list-styles inline secondlist">
<li class="select2"><a href="#1_programs">Programs</a></li> |
<li><a href="#1_policies">Policies</a></li> |
<li><a href="#1_success">Success Stores</a></li> |
<li><a href="#1_tools">Tools</a></li> |
<li><a href="#1_funding">Funding</a></li>
</ul>
</div>
</div>
<div id="orange_box">
</div>
<script>
$(document).ready(function() {
$('#firstlist a').click(function(){
$('#firstlist li').removeClass('select1');
$(this).parent().addClass('select1');
href=$(this).attr('href');
$('#orange_box').html($('#firstlistmenu '+href).html());
$('#orange_box li:first').addClass('select2');
});
$('#orange_box .secondlist a').click(function(){
alert('hello');
$('.secondlist li').removeClass('select2');
$(this).parent().addClass('select2');
});
});
</script>