Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,237 members, 7,780,465 topics. Date: Thursday, 28 March 2024 at 02:58 PM

Javascript Issue - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Javascript Issue (999 Views)

Whats An Easy Solution To This Javascript Issue / The Javascript Thread / After 10days Of Coding With Html, Css And Javascript Forum4africa Is Ready (2) (3) (4)

(1) (Reply) (Go Down)

Javascript Issue by babajeje123(m): 11:45am On Dec 29, 2020
Can someone please help me to look at these code?
Re: Javascript Issue by babajeje123(m): 11:47am On Dec 29, 2020
Nairaland is preventing me from posting the code cry cry cry
Re: Javascript Issue by Csami(m): 12:18pm On Dec 29, 2020
babajeje123:
Nairaland is preventing me from posting the code cry cry cry

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(m): 5:05pm On Dec 29, 2020
Okay, see this. It is not working.

Re: Javascript Issue by babajeje123(m): 5:08pm On Dec 29, 2020
Whereas, this is working.

Re: Javascript Issue by babajeje123(m): 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:
Okay, see this. It is not working.

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.

1 Like

Re: Javascript Issue by babajeje123(m): 5:19pm On Dec 29, 2020
Karleb:


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.
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:

I used notepad as text editor, reason why the code is not well indented

Sublime text is only 10mb.

Coding with notepad is torture.

4 Likes

Re: Javascript Issue by Pearlbaby(m): 7:13pm On Dec 29, 2020
babajeje123:
Whereas, this is working.
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:
Okay, see this. It is not working.

you did not add value attribute to them
e.g

<input type="radio" name="colours" id="purple" value="purple" > Purple

1 Like

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

1 Like

Re: Javascript Issue by sholarr12: 11:39am On Dec 30, 2020
babajeje123:

I used notepad as text editor, reason why the code is not well indented
Karleb:
Take screen shot with your computer and post here.
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:
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 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:
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.

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:


These days, semicolons are optional in Javascript.

Try to break your code into multiple lines though.
It's easier to read that way.
I copied it from your help already. See:

(1) (Reply)

Is This 'NFT' Worthy? / Generating Reports / Please Post Codes To Link Vb.net + Sql. Final Year Project

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.