Using JQuery

I n have a <td> like below

<td width=“33” class=cellTextGreyLeft><input type=“checkbox” class=“selectColumn selectColumnAmericas column17 " name=“strCustTerr1” value=”" align=“middle” /></td>

I want to pick data

Americas

column17

and 17

when a user click on this td .

what JQuery syntax I should be using here ?

html


<table border="1">
    <td width="33" class="cellTextGreyLeft">
        <input type="checkbox" 
            class="selectColumn selectColumnAmericas column17" 
            name="strCustTerr1" 
            value="" 
            align="middle" />
    </td>
</table>

2 clicks attached, to cell and to the check box. When you’ll click the check box, both events for the check box and the td will fire as the check box is inside the td. Once you have the class value, split it, this will give you an array which in turn you can utilize.


<script type="text/javascript">
    $(document).ready(function(){
        //table cell click
        $('.cellTextGreyLeft').click(function(){
            //can use children and find both
            var myclassValues = $(this).children('input[name="strCustTerr1"]').attr('class');
            alert('td clicked = '+myclassValues);
            

        });
        //checkbox click
        $('input[name="strCustTerr1"]').click(function(){
            var myclassValues = $(this).attr('class');
            alert(myclassValues);
        });

    });

</script>