所以我正在研究折扣代码功能,尽管它进展得并不顺利。 到目前为止,这是我的代码:
---
- hosts: hqdbepo1
gather_facts: true
become: false
tasks:
- name: check NuGet version
win_shell: (Get-PackageProvider -Name NuGet -Force | Select-Object Version | Format-Table -HideTableHeaders | Out-String).Trim()
register: nuget_version
changed_when: false
check_mode: false
- name: Ensure the required NuGet package provider version is installed
debug: var=nuget_version['stdout_lines'][0]
when: nuget_version['stdout_lines'][0] | string | replace('', '0.0.0.1') is version('2.8.5.0', '<')
var discount = document.getElementById("disc");
function greets(){
var input = discount.values
if(input == "Hey"){
console.log("heyback");
}
}
html {
background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
text-align: center;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
所以我想知道如何知道用户是否在文本输入框中输入了某个单词,如果输入了,请记录一些内容。你能帮忙吗?
在你说“使用 .value 而不是 .textContent”之前。它不会让我使用 .value。这也是我的问题的一部分!
答案 0 :(得分:0)
您可能希望挂钩该元素的 input event,如下所示:
const discount = document.getElementById("disc");
discount.addEventListener('input', ev => {
if (ev.target.value === 'Hey') {
console.log('heyback');
}
});
html {
background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
text-align: center;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
<h1>Purchase A Product</h1>
<form id="f">
<input id="disc" />
</form>