summaryrefslogtreecommitdiff
path: root/public/libs/steps.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/libs/steps.js')
-rw-r--r--public/libs/steps.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/public/libs/steps.js b/public/libs/steps.js
new file mode 100644
index 0000000..be7cc6b
--- /dev/null
+++ b/public/libs/steps.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(`
+ <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 photo:</label>
+ <input id='added${step}' name='step${step}[photo]' type="text">
+ <label id='added${step}' for="">Step instructions:</label>
+ <input id='added${step}' name='step${step}[step]' type="text">
+ `)
+});
+
+$('#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 < 6; i++) {
+ $(`#added${toRm}`).remove();
+ }
+}); \ No newline at end of file