diff options
author | root <root@vagrantz.xyz> | 2021-04-06 10:57:50 +0000 |
---|---|---|
committer | root <root@vagrantz.xyz> | 2021-04-06 10:57:50 +0000 |
commit | 8170d5bc0544fbc02155b8b57751cd1dec33dd69 (patch) | |
tree | d5cffb086fe6d5585c1e00ea5d5d2d907e6d2cd6 /public/libs/main.js |
Diffstat (limited to 'public/libs/main.js')
-rw-r--r-- | public/libs/main.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/public/libs/main.js b/public/libs/main.js new file mode 100644 index 0000000..93508ce --- /dev/null +++ b/public/libs/main.js @@ -0,0 +1,23 @@ +$('#plus').on('click', (event) => { + const newVal = parseInt(document.querySelector('#stpnum').value) + 1; + document.querySelector('#stpnum').value = newVal; + const step = newVal; + $('#sub').before(` + <div id='added${step}' class='adds'> + <label id='added${step}' for="">Step Number:</label> + <input id='added${step}' name='step${step}[number]' type='text' value='${step}'> + <label id='added${step}' for="">Step instructions:</label> + <textarea id='added${step}' name='step${step}[step]'></textarea> + </div> + `) +}); + +$('#minus').on('click', (event) => { + const newVal = parseInt(document.querySelector('#stpnum').value) - 1; + document.querySelector('#stpnum').value = newVal; + const step = newVal; + const toRm = step + 1; + for(i = 0; i < 7; i++) { + $(`#added${toRm}`).remove(); + } +}); |