Hide elements on webform until they are needed #48

Open
W1CDN wants to merge 2 commits from prettify into main
Showing only changes of commit 269cbfdd22 - Show all commits

View File

@ -186,9 +186,7 @@ const char index_html[] PROGMEM = R"rawliteral(
<script type="text/javascript">
// Show more stuff depending on selected values
// https://stackoverflow.com/a/24849350
document
.getElementById('message')
.addEventListener('change', function () {
show_message = function () {
'use strict';
var vis_message = document.querySelector('.vis_message'),
target = document.getElementById("message"+this.value);
@ -198,10 +196,8 @@ const char index_html[] PROGMEM = R"rawliteral(
if (target !== null ) {
target.className = 'vis_message';
}
});
document
.getElementById('send-program')
.addEventListener('change', function () {
}
show_program = function () {
'use strict';
var vis_program = document.querySelector('.vis_program'),
target = document.getElementById("program"+this.value);
@ -211,7 +207,13 @@ const char index_html[] PROGMEM = R"rawliteral(
if (target !== null ) {
target.className = 'vis_program';
}
});
}
document
.getElementById('message')
.addEventListener('change', show_message);
document
.getElementById('send-program')
.addEventListener('change', show_program);
</script>
</body></html>)rawliteral";