我需要帮助更改我的代码,以便在单击链接 id 示例时更改 div 内容:我单击第一个链接,它打印出 1 等等。它还将有一个独特的链接#first。默认情况下,它显示“默认”
<script src="jquery.js"></script>
<script src="jquery.bbq.js"></script>
<script>
$(function () {
var tabContainers = $('div.tabs > div');
tabContainers.hide().filter(':first').show();
$(window).bind('hashchange', function () {
var hash = window.location.hash || '#first';
tabContainers.hide();
tabContainers.filter(hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$('a[hash=' + hash + ']').addClass('selected');
});
$(window).trigger( "hashchange" );
});
</script>
<ul class="tabNavigation">
<li><a href="#first" id="1">First</a></li>
<li><a href="#second" id="2">Second</a></li>
<li><a href="#third" id="3">Third</a></li>
</ul>
<div class="tabs">
Change content here
</div>