Javascript Issue - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Javascript Issue (1245 Views)
| Javascript Issue by babajeje123(op): 11:45am On Dec 29, 2020 |
Can someone please help me to look at these code? |
| Re: Javascript Issue by babajeje123(op): 11:47am On Dec 29, 2020 |
Nairaland is preventing me from posting the code |
| Re: Javascript Issue by Csami(m): 12:18pm On Dec 29, 2020 |
babajeje123:Snap and post |
| Re: Javascript Issue by Karleb(m): 12:22pm On Dec 29, 2020 |
Take screen shot with your computer and post here. |
| Re: Javascript Issue by babajeje123(op): 5:05pm On Dec 29, 2020 |
Okay, see this. It is not working.
|
| Re: Javascript Issue by babajeje123(op): 5:08pm On Dec 29, 2020 |
Whereas, this is working.
|
| Re: Javascript Issue by babajeje123(op): 5:09pm On Dec 29, 2020 |
They are the same but performing different tasks. |
| Re: Javascript Issue by Karleb(m): 5:15pm On Dec 29, 2020 |
babajeje123:Oga! getElementById will only pick one tag. Use getElementsByClassName to get all the inputs in first picture. Advice. Look into let and const keywords. Try to know about code indentation. |
| Re: Javascript Issue by babajeje123(op): 5:19pm On Dec 29, 2020 |
Karleb:I used notepad as text editor, reason why the code is not well indented |
| Re: Javascript Issue by Karleb(m): 5:27pm On Dec 29, 2020 |
babajeje123:Sublime text is only 10mb. Coding with notepad is torture. |
| Re: Javascript Issue by Pearlbaby(m): 7:13pm On Dec 29, 2020 |
babajeje123:For the checkColours function, you used getElementbyID but you are getting the name instead. |
| Re: Javascript Issue by etoluw: 8:25pm On Dec 29, 2020 |
babajeje123:you did not add value attribute to them e.g <input type="radio" name="colours" id="purple" value="purple" > Purple |
| Re: Javascript Issue by heyiamjosh(m): 10:02pm On Dec 29, 2020 |
Obviously, this code won't work. Your issues; 1. You're getting element by id but you're putting name, 2. getElementById does not return an array. So therefore, your for loop won't work and, 3. Your inputs does not have values |
| Re: Javascript Issue by sholarr12: 11:39am On Dec 30, 2020 |
babajeje123: Karleb:I don't know if you could help too. Could you please help with this JavaScript code asking me to return a string/statement?:
|
| Re: Javascript Issue by Karleb(m): 12:00pm On Dec 30, 2020 |
sholarr12:
|
| Re: Javascript Issue by sholarr12: 12:06pm On Dec 30, 2020 |
Thank you very much. I have been able to do it with your help. It was basically the omission of the semi colon to signal the end of each line that was the issue I guess! Thank you, sir.
|
| Re: Javascript Issue by Karleb(m): 12:16pm On Dec 30, 2020 |
sholarr12:These days, semicolons are optional in Javascript. Try to break your code into multiple lines though. It's easier to read that way. |
| Re: Javascript Issue by sholarr12: 12:22pm On Dec 30, 2020 |
Karleb:I copied it from your help already. See:
|
Whats An Easy Solution To This Javascript Issue • Mobile Technology: Lets Build A Mobile App With Javascript • Free HTML5, CSS3 And Basic Javascript (jquery) Training • 2 • 3 • 4
Anyone With Free Resources On Learning Laravel • Maui Controls Guides For Beginner C# • Programming Group For Python