我有一个表单,并且有一个按钮正在过滤某些必填字段。一切正常,但我还想更改按钮的文本。 例如:默认情况下,它在表单中显示所有字段,当您单击按钮(显示必填字段)时,它仅显示必填字段,这里我要更改按钮上的文本以显示文本(全部显示)。
这是我的代码:
<button type="checkbox" onclick="yesnoCheck();" id="yesCheck" value="Show required fields">Show required fields</button> <br>
<div id="ifYes">
<input type="text" value="" /> One
<input type="text" value="" />Two
<input type="text" value="" />Three
<input type="text" value="" required/>Four
</div>
JS:
function yesnoCheck() {
var x = document.getElementById("ifYes");
if (x.style.display === "none") {
x.style.display = "flex";
} else {
x.style.display = "none";
}
}
基本上,当您单击按钮以显示必填字段时,我想将文本更改为“全部显示”。
答案 0 :(得分:0)
这是您要找的吗?
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.dependencies[].["@gx/core"] |= (if . == "0.279.0-b1-abc-1234-0716.4567" then "0.279.0-b1-abc-1234-0716.9856" else . end)
jq: 1 compile error
I am looking for something like this
jq '.dependencies[].["@gx/[a-z]*"] |= (if . == "^(\d+\.){2}[0-9]+(-[a-zA-Z0-9]*){4}\.[0-9]*$" then "0.279.0-b1-abc-1234-0716.9856" else . end)' info.json
function yesnoCheck() {
var x = document.getElementById("ifYes");
var button = document.getElementById("yesCheck");
if (x.style.display === "none") {
x.style.display = "flex";
button.textContent = "Show required fields";
} else {
x.style.display = "none";
button.textContent = "Show All";
}
}