+ 1

Fixing this code

So I have this code. There are specific things I want to happen, but don't know how to make them happen. For instance, I want the submit button to always say "submit" regardless of the previous input value. And the button should always say "Click Me" I guess what I'm saying is I want each input to ignore the value of the previous input. So when I set a date for the date input, then switch to the button, The button should say "Click Me" rather than the date from the previous input. https://code.sololearn.com/WZMmxqy8BKtj/?ref=app

28th Jul 2018, 8:58 PM
Daniel Cooper
Daniel Cooper - avatar
9 Answers
+ 1
Well you can add an if statement in your Attr() function: if (attribute == "button") elem.value = "Click me"; then keep doing this for all the specific input types
28th Jul 2018, 9:05 PM
ReimarPB
ReimarPB - avatar
+ 1
Intermediate solution: i.e. deleting previous selection. https://code.sololearn.com/WzbA62cH8x7y/?ref=app Not sure I can finish it until the morning at least, sorry. Edit: Daniel Cooper updated code. I don’t seem to be able to use the ‘color’ option on iOS, so I don’t know how that works, but the rest seems to be working for me. Hope this is what you need.
28th Jul 2018, 10:04 PM
Russ
Russ - avatar
+ 1
Daniel Cooper You need associated array to keep track all the options texts. eg. sel["button"] = "button text"; sel["number"] = "12345"; and ect..
29th Jul 2018, 1:07 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
Codes calculates all section, can't do partially. Here the codes https://code.sololearn.com/W37weENunVkx/?ref=app
29th Jul 2018, 4:12 AM
CalviŐ˛
CalviŐ˛ - avatar
0
I tried that but it didn't seem to work. Maybe I misspelled something.
28th Jul 2018, 9:08 PM
Daniel Cooper
Daniel Cooper - avatar
0
I can't get it to work. Nothing is misspelled halp :(
28th Jul 2018, 9:56 PM
Daniel Cooper
Daniel Cooper - avatar
0
For the submit button you can add value="Submit" to the button.
28th Jul 2018, 10:20 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
0
Russ That doesn't work. I chose the color option, then chose the button option, the value from the color option remained. I'll have to experiment.
28th Jul 2018, 10:57 PM
Daniel Cooper
Daniel Cooper - avatar
0
Can I have an example? (You can just do one) I learn better by seeing the code
29th Jul 2018, 3:11 AM
Daniel Cooper
Daniel Cooper - avatar