Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.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 文本字段禁用问题_Javascript_Php_Jquery_Html - Fatal编程技术网

Javascript 文本字段禁用问题

Javascript 文本字段禁用问题,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我正在使用PHP,我编写了一个包含文本和数字字段的简单表单。有一个字段禁用了input type=“number”。我无法在该字段中键入任何值。该字段自动获取数据,但我想在该字段中键入或更改值 该字段的名称是“单位数”input type=“Number”value=“0”min=“0” 这是。这是您输入的html <input class="form-control cartontot js-numbers" type="number" contenteditable="true" na

我正在使用PHP,我编写了一个包含文本和数字字段的简单表单。有一个字段禁用了
input type=“number”
。我无法在该字段中键入任何值。该字段自动获取数据,但我想在该字段中键入或更改值

该字段的名称是“单位数”
input type=“Number”value=“0”min=“0”


这是。

这是您输入的html

<input class="form-control cartontot js-numbers" type="number" contenteditable="true" name="unit" id="unit" min="0" required="" placeholder="required" value="0" readonly="">
请记住,
disabled
readonly
属性用于禁用html中的输入

编辑

    $('.pnm, .price, .subtot, .grdtot, .widtot, .perm, .tottot, .voltot, .vol, .tot, .vols, .cartontot, .widths, .depths, .heights, .acts').prop('readonly', true);

检查写在代码某处的代码,只需从中删除
cartonot
此类

如果元素为只读或禁用,则无法更改其值。尝试删除只读或已禁用,然后键入任何内容

另一个选项是可以使用Javascript或JQuery。代码第9行:

$('.pnm, .price, .subtot, .grdtot, .widtot, .perm, .tottot, .voltot, .vol, .tot, .vols, .cartontot, .widths, .depths, .heights, .acts').prop('readonly', true);
此输入元素包含类
cartonot


您的javascript正在为其添加只读属性。

没有使用只读条件请尽快向我提供。Mam first post property problem statement yes readonly是一个属性&在我的代码中,该字段没有应用readonly属性。我发布了只包含链接和无代码的问题,这里没有主题。三小时后,你发布了另一个-你能确认你正在阅读关于你的问题的评论吗?我检查了我的代码行,但没有用于该字段的只读属性看到实际代码是该字段的单位数吗检查我的答案编辑部分是的,很好,它正在工作。非常感谢,先生,谢谢你的帮助我接受/使用您的代码及其工作原理我将点击按钮。再次感谢你,不客气!
$('.pnm, .price, .subtot, .grdtot, .widtot, .perm, .tottot, .voltot, .vol, .tot, .vols, .cartontot, .widths, .depths, .heights, .acts').prop('readonly', true);