Sourabh Dhiman

Sourabh Dhiman

  • 2k
  • 49
  • 1.4k

Get Particular Id.

Apr 17 2021 4:22 PM
How to get Particular Id li click .
<ul class="list-group--alt">
@foreach (var category in Model)
{
<li><a href="/sample?CategoryId=@category.CategoryId">@category.Title</a></li>
}
</ul>
<script>
$(document).ready(function () {
debugger;
$('.li').on('click', function () {
var id = $(this).parent('ul').attr('id');
alert(id);
});
});
</script>
 

Answers (1)