Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.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_Html - Fatal编程技术网

Javascript 提交后在待办事项列表上编辑我的输入

Javascript 提交后在待办事项列表上编辑我的输入,javascript,html,Javascript,Html,一个编辑功能,我可以在提交后更正输入。[创建待办事项列表。] <script> function bigImg(x) { x.style.height = "74px"; x.style.width = "74px"; } function normalImg(x) { x.style.height = "39px"; x.style.width = "39px"; } submitForm = (value, displayer) => {

一个编辑功能,我可以在提交后更正输入。[创建待办事项列表。]

<script>

function bigImg(x) {

  x.style.height = "74px";

  x.style.width = "74px";

}

function normalImg(x) {

  x.style.height = "39px";

  x.style.width = "39px";
}



submitForm = (value, displayer) => {

    let input = document.getElementById(value);

    let valueHolder = document.getElementById(displayer);

    let inputValue = input.value;

    valueHolder.innerHTML = inputValue;
};

const form = document.getElementById('formSubmission');

form.addEventListener('submit', (e) => {

    e.preventDefault();

    submitForm('inputData', 'valueHolder');

});


div id="myDIV" class="header">

  <h2>My To Do List</h2>

  <input type="text" id="myInput" placeholder="My List...">

  <span onclick="newElement()" class="addBtn">Add</span>

</div>






<ul id="myUL">

  <li>Hit the gym</li>

  <li class="checked">Pay bills</li>

  <li>Meet George</li>

  <li>Buy eggs</li>

  <li>Read a book</li>

  <li>Organize office</li>

</ul> 

函数bigImg(x){
x、 style.height=“74px”;
x、 style.width=“74px”;
}
函数normalImg(x){
x、 style.height=“39px”;
x、 style.width=“39px”;
}
submitForm=(值,显示器)=>{
让输入=document.getElementById(值);
让valueHolder=document.getElementById(显示器);
让inputValue=input.value;
valueHolder.innerHTML=输入值;
};
const form=document.getElementById('formSubmission');
表格.addEventListener('submit',(e)=>{
e、 预防默认值();
提交表格(“inputData”、“valueHolder”);
});
div id=“myDIV”class=“header”>
我的任务清单
添加
  • 去健身房
  • 支付账单
  • 见见乔治
  • 买鸡蛋
  • 读书
  • 组织办公室

示例:-如果我添加一个任务,说买5个鸡蛋。但我需要两个鸡蛋。我不需要删除整个任务。相反,我只是编辑我的任务,说购买2个GGS。

不是那么简单,但这里有一个可能的起点,可以帮助您完成以下任务:

函数bigImg(x){
x、 style.height=“74px”;
x、 style.width=“74px”;
}
函数normalImg(x){
x、 style.height=“39px”;
x、 style.width=“39px”;
}
submitForm=(值,显示器)=>{
让输入=document.getElementById(值);
让inputValue=input.value;
const task=inputValue.replace(/[\d]/g'').replace('');
让valueHolder=document.querySelector('li[data task=“”+task+”);
如果(!价值持有人){
valueHolder=document.createElement('li');
valueHolder.dataset.task=任务;
文件.getElementById('myUL').appendChild(价值持有人);
}
valueHolder.innerHTML=输入值;
};
const form=document.getElementById('formSubmission');
表格.addEventListener('submit',(e)=>{
e、 预防默认值();
提交表格(“inputData”、“valueHolder”);
});

我的任务清单
添加
  • 去健身房
  • 支付账单
  • 会见乔治
  • 买鸡蛋
  • 阅读一本书 组织办公室