---
description: Theme Newspaper
---

# Thay đổi class active javascript bằng cách viết hàm (P1)

```markup
<ul class="td-panel-menu">
	<li class="td-panel-welcome">
		<a href="#" class="td-panel-menu-active" data-panel="td-panel-welcome">
			<span class="td-sp-nav-icon td-ico-header"></span>
			Header
			<span class="td-arrow"></span>
		</a>
	</li>
	<li class="td-panel-footer">
		<a href="#" data-panel="td-panel-footer">
			<span class="td-sp-nav-icon td-ico-footer"></span>
			Footer
			<span class="td-arrow"></span>
		</a>
	</li>
</ul>
```

```typescript
function panel_navigation() {
	jQuery('.td-panel-menu a').click(function(event) {
		if(typeof jQuery(this).data('panel')=='undefined'){
			return;
		};
		event.preventDefault();
		jQuery('.td-panel-menu-active').removeClass('td-panel-menu-active');
		jQuery(this).addClass('td-panel-menu-active');
	});
};
jQuery().ready(function() {
	panel_navigation();
});
```
