Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 单击另一个td中但在同一tr中的复选框时,如何查找td中的值?_C#_Jquery_Asp.net - Fatal编程技术网

C# 单击另一个td中但在同一tr中的复选框时,如何查找td中的值?

C# 单击另一个td中但在同一tr中的复选框时,如何查找td中的值?,c#,jquery,asp.net,C#,Jquery,Asp.net,我有一个只有几列和几行的表。单击每行开头的复选框时,我希望将特定单元格的值存储到一个变量中,并将其用于其他内容的比较 如何从与单击的复选框位于同一行的单元格中获取数据 此函数由单击的复选框的单击事件调用 function checkLives if ($('.CarrierID:contains("2")', $( ':checkbox' ).parents( 'td' ) ).length > 0 ) { //if its not dental

我有一个只有几列和几行的表。单击每行开头的复选框时,我希望将特定单元格的值存储到一个变量中,并将其用于其他内容的比较

如何从与单击的复选框位于同一行的单元格中获取数据

此函数由单击的复选框的单击事件调用

 function checkLives
 if ($('.CarrierID:contains("2")', $( ':checkbox' ).parents( 'td' ) ).length > 0 )
        {
            //if its not dental
            <%if (this.CurrentProduct != Products.Dental){%>

                //if the lives being quoted are over 16

                //Here is where I would need the value inside of that table row
                if (livesover16)
                {
                    //show popup
                  $('#over16').dialog('open');
                    return false;

            <%}%>
        }
函数检查寿命
if($('.CarrierID:contains(“2”),$(':checkbox”).parents('td')).length>0)
{
//如果不是牙科的话
//如果引用的生命超过16条
//在这里,我需要该表行中的值
如果(livesover16)
{
//显示弹出窗口
$('超过16')。对话框('打开');
返回false;
}

类似的方法应该有效(如果不看到html,很难更精确):


让我们看看页面的HTML(不是生成页面的服务器端代码,而是实际的HTML)。
$('input[type="checkbox"]').on('change', function(){

     var tdtext = $(this) //the current clicked chexbox
                   .closest('tr') //the wrapping tr of the chechbox
                   .find('td') //find the td
                   .text(); //get the text 
});