WorknHardr
asked on
JQuery ASP Gridview Closest Cell Value?
I have a click event to get the clicked cell value and the cell in the row below. Trying to sum two cells. The code below worked fine before I added the 'closest' syntax. Ultimately I need to loop through the entire grid comparing grid cells. Help
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></s cript>
<script type="text/javascript">
$(document).ready(function ()
{
$("#GridView1 td").click(function ()
{
alert('top:' = $(this).html() + ' bottom:' + $(this).closest('tr').find ('td').htm l() );
//alert($(this).html());
});
});
</script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></s
<script type="text/javascript">
$(document).ready(function
{
$("#GridView1 td").click(function ()
{
alert('top:' = $(this).html() + ' bottom:' + $(this).closest('tr').find
//alert($(this).html());
});
});
</script>
ASKER
I need to compare value of 'cell1' with value of 'cell2'
[Gridview]
Header Column1
Row1 [cell1]
Row2 [cell2]
...
Footer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent!
Curious, how do I use the bottomVal object?
It does NOT work like this for sure:
if (topVal != bottomVal) {
$(bottomVal).addClass("grd Cell");
}
<style type="text/css">
.grdCell
{
background-color:Yellow;
}
</style>
Curious, how do I use the bottomVal object?
It does NOT work like this for sure:
if (topVal != bottomVal) {
$(bottomVal).addClass("grd
}
<style type="text/css">
.grdCell
{
background-color:Yellow;
}
</style>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent! thx...
Which cell are you expecting to get by using the closest() function