I'm using asp.net web api project and using jquery template in that.
in ready
$('a').click(function () {
debugger;
// remove the selected class from all anchors
$('.row a').removeClass('selected');
// Add the selected class to the currently clicked anchor
$(this).addClass('selected');
});
<div class="row">
<div class="span3">
<!-- Added dynamic data from script GroupTypeTemplate -->
</div>
</div>
<script id="GroupTypeTemplate" type="text/html">
<nav id="options" class="work-nav">
<ul id="filters" class="option-set" data-option-key="filter">
<li>
<a onclick="getGroupById('${Id}')" data-option-value="*">${TypeName}</a>
</li>
</ul>
</nav>
</script>
I want to set that
classattribute dynamically as per which menu is currently active
But how to check which id is currently active accordingly I can set class="selected"
What is the syntax in jquery template ?