This code is used to find the first and last element from the list of elements. Using the class name of the elements the first and last element is identified.
<script type='text/javascript'>
$(document).ready(function() {
$('#check').click(function(e)
{
var first = $('.activated:first').html();
var lastt = $('.activated:last').html();
$("#msg").html("First Element : "+first+" , Last Element :"+lastt);
});
});
</script>
</style>
<ul id='thisli'>
<li class='activated'>Hscripts.com</li>
<li class='activated'>Statsmonkey.com</li>
<li class='activated'>Hibihi.com</li>
<li class='activated'>Easycalculation.com</li>
<li class='activated'>Hiox.com</li>
</ul>
<input type='button' v