Reveal hidden Div 在提交时保持隐藏状态
Reveal hidden Div stays hidden on submit
您好,我有一个模态表单。在这个表单中有一个提交按钮。我只有在单击此按钮时才想显示结果。这些结果在模态之外,应在单击提交按钮后显示。我设法隐藏了结果,但似乎无法揭示它。这是我得到的:
function onSubmit(){
document.getElementById('submitButton').style.display = "none";
document.getElementById('revealProgress').style.display = "block";
return true;
}
#revealProgress{
display: none;
}
<button onclick =" window.location.href = '#close'; deleteData(); getData();;" href="#close" id="submitButton" class="tester2" > Submit </button>
<div id = "revealProgress">
<p>Exercise: <strong id="exerciseList"></strong></p></strong></p><br>
<p>Sets: <strong id="setList"></strong></p></strong></p><br>
<p>Reps: <strong id="repList"></strong></p></strong></p><br>
<p>Weight: <strong id="weightList"></strong></p></strong></p><br>
<p>total: <strong id="totalList"></strong></p></strong></p><br>
<div id="progress_bar"></div>
</div>
你看到我哪里做错了吗?
你根本没有使用JS函数,所以没有任何反应!
针对您的情况,最简单的解决方案是将其替换为:
onclick =" window.location.href = '#close'; deleteData(); getData();;"
有了这个:
onclick = "onSubmit()"
这样做后的工作片段如下:
function onSubmit(){
document.getElementById('submitButton').style.display = "none";
document.getElementById('revealProgress').style.display = "block";
return true;
}
#revealProgress{
display: none;
}
<button onclick = "onSubmit()" href="#close" id="submitButton" class="tester2" > Submit </button>
<div id = "revealProgress">
<p>Exercise: <strong id="exerciseList"></strong></p></strong></p><br>
<p>Sets: <strong id="setList"></strong></p></strong></p><br>
<p>Reps: <strong id="repList"></strong></p></strong></p><br>
<p>Weight: <strong id="weightList"></strong></p></strong></p><br>
<p>total: <strong id="totalList"></strong></p></strong></p><br>
<div id="progress_bar"></div>
</div>
您好,我有一个模态表单。在这个表单中有一个提交按钮。我只有在单击此按钮时才想显示结果。这些结果在模态之外,应在单击提交按钮后显示。我设法隐藏了结果,但似乎无法揭示它。这是我得到的:
function onSubmit(){
document.getElementById('submitButton').style.display = "none";
document.getElementById('revealProgress').style.display = "block";
return true;
}
#revealProgress{
display: none;
}
<button onclick =" window.location.href = '#close'; deleteData(); getData();;" href="#close" id="submitButton" class="tester2" > Submit </button>
<div id = "revealProgress">
<p>Exercise: <strong id="exerciseList"></strong></p></strong></p><br>
<p>Sets: <strong id="setList"></strong></p></strong></p><br>
<p>Reps: <strong id="repList"></strong></p></strong></p><br>
<p>Weight: <strong id="weightList"></strong></p></strong></p><br>
<p>total: <strong id="totalList"></strong></p></strong></p><br>
<div id="progress_bar"></div>
</div>
你看到我哪里做错了吗?
你根本没有使用JS函数,所以没有任何反应!
针对您的情况,最简单的解决方案是将其替换为:
onclick =" window.location.href = '#close'; deleteData(); getData();;"
有了这个:
onclick = "onSubmit()"
这样做后的工作片段如下:
function onSubmit(){
document.getElementById('submitButton').style.display = "none";
document.getElementById('revealProgress').style.display = "block";
return true;
}
#revealProgress{
display: none;
}
<button onclick = "onSubmit()" href="#close" id="submitButton" class="tester2" > Submit </button>
<div id = "revealProgress">
<p>Exercise: <strong id="exerciseList"></strong></p></strong></p><br>
<p>Sets: <strong id="setList"></strong></p></strong></p><br>
<p>Reps: <strong id="repList"></strong></p></strong></p><br>
<p>Weight: <strong id="weightList"></strong></p></strong></p><br>
<p>total: <strong id="totalList"></strong></p></strong></p><br>
<div id="progress_bar"></div>
</div>