Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
Javascript $tds.attr(';disabled';,';disabled';);不按我的要求工作_Javascript_Jquery - Fatal编程技术网

Javascript $tds.attr(';disabled';,';disabled';);不按我的要求工作

Javascript $tds.attr(';disabled';,';disabled';);不按我的要求工作,javascript,jquery,Javascript,Jquery,此代码: $tds = $(this).closest('tr').find(td input,select); $tds.attr('disabled','disabled'); 使我的表格行不可编辑,也不可浏览。然而,我确实在表行单元格中更改了隐藏输入的值,如果使用aboce代码,则不会更改该值。所以我决定不使用它 现在,我正在寻找一种使用以下工具的方法: document.getElementById(“myText”).readOnly=true,这适用于单个输入,但我确实希望输入、

此代码:

$tds = $(this).closest('tr').find(td input,select);
 $tds.attr('disabled','disabled');
使我的表格行不可编辑,也不可浏览。然而,我确实在表行单元格中更改了隐藏输入的值,如果使用aboce代码,则不会更改该值。所以我决定不使用它

现在,我正在寻找一种使用以下工具的方法:


document.getElementById(“myText”).readOnly=true
,这适用于单个输入,但我确实希望输入、选择和按钮为只读或不可单击该单击行。

使用选择器中的
input
获取
input
选择
按钮
,假设您在
tr
上单击了事件,那么您需要找到输入元素,这些元素是tr的
后代,可以使用函数进行选择。为要绑定click事件并使用的tr分配一个公共类

同时使用
prop
代替
attr

从jQuery1.6开始,.attr()方法返回未定义的属性 这还没有确定。检索和更改DOM属性,如 表单元素的选中、选中或禁用状态使用 .prop()方法

如果要将click事件添加到td而不是tr

$('.tdclass').click(function(){
   $(this).closest('tr').find('input').prop('readonly', true);
});

使用选择器中的
input
获取
input
选择
按钮
,假设您在
tr
上单击了事件,那么您需要找到那些是tr的
后代
的输入元素,这些元素可以使用函数进行选择。为要绑定click事件并使用的tr分配一个公共类

同时使用
prop
代替
attr

从jQuery1.6开始,.attr()方法返回未定义的属性 这还没有确定。检索和更改DOM属性,如 表单元素的选中、选中或禁用状态使用 .prop()方法

如果要将click事件添加到td而不是tr

$('.tdclass').click(function(){
   $(this).closest('tr').find('input').prop('readonly', true);
});

使用选择器中的
input
获取
input
选择
按钮
,假设您在
tr
上单击了事件,那么您需要找到那些是tr的
后代
的输入元素,这些元素可以使用函数进行选择。为要绑定click事件并使用的tr分配一个公共类

同时使用
prop
代替
attr

从jQuery1.6开始,.attr()方法返回未定义的属性 这还没有确定。检索和更改DOM属性,如 表单元素的选中、选中或禁用状态使用 .prop()方法

如果要将click事件添加到td而不是tr

$('.tdclass').click(function(){
   $(this).closest('tr').find('input').prop('readonly', true);
});

使用选择器中的
input
获取
input
选择
按钮
,假设您在
tr
上单击了事件,那么您需要找到那些是tr的
后代
的输入元素,这些元素可以使用函数进行选择。为要绑定click事件并使用的tr分配一个公共类

同时使用
prop
代替
attr

从jQuery1.6开始,.attr()方法返回未定义的属性 这还没有确定。检索和更改DOM属性,如 表单元素的选中、选中或禁用状态使用 .prop()方法

如果要将click事件添加到td而不是tr

$('.tdclass').click(function(){
   $(this).closest('tr').find('input').prop('readonly', true);
});

不是您的示例的精确表示,但说明了这一点:

包装
td输入,在引号中选择
,以便:

$tds = $(this).closest('tr').find('td input,select');
$tds.attr('disabled','disabled');

不是您的示例的精确表示,但说明了这一点:

包装
td输入,在引号中选择
,以便:

$tds = $(this).closest('tr').find('td input,select');
$tds.attr('disabled','disabled');

不是您的示例的精确表示,但说明了这一点:

包装
td输入,在引号中选择
,以便:

$tds = $(this).closest('tr').find('td input,select');
$tds.attr('disabled','disabled');

不是您的示例的精确表示,但说明了这一点:

包装
td输入,在引号中选择
,以便:

$tds = $(this).closest('tr').find('td input,select');
$tds.attr('disabled','disabled');

使用
$tds.prop('disabled',true)您缺少报价:查找(td输入,选择);应该是find('td input,select')@ArunPJohny,仍然不工作。你能分享一些代码的上下文吗,比如html和使用它的javascript函数…
$tds=$(this).closest('tr')。find('td input,select')$tds.道具(“禁用”,真实)$tds.prop('readonly',true)使用
$tds.prop('disabled',true)您缺少报价:查找(td输入,选择);应该是find('td input,select')@ArunPJohny,仍然不工作。你能分享一些代码的上下文吗,比如html和使用它的javascript函数…
$tds=$(this).closest('tr')。find('td input,select')$tds.道具(“禁用”,真实)$tds.prop('readonly',true)使用
$tds.prop('disabled',true)您缺少报价:查找(td输入,选择);应该是find('td input,select')@ArunPJohny,仍然不工作。你能分享一些代码的上下文吗,比如html和使用它的javascript函数…
$tds=$(this).closest('tr')。find('td input,select')$tds.道具(“禁用”,真实)$tds.prop('readonly',true)使用
$tds.prop('disabled',true)您缺少报价:查找(td输入,选择);应该是find('td input,select')@ArunPJohny,仍然不工作。你能分享一些代码的上下文吗,比如html和使用它的javascript函数…
$tds=$(this).closest('tr')。find('td input,select')$tds.道具(“禁用”,真实)$tds.prop('readonly',true)