Sourabh Dhiman

Sourabh Dhiman

  • NA
  • 49
  • 5.5k

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="/[email protected]">@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)