Need a little help with my javascript code. can anyone help?

hey guys, please i am new to coding and i am having a hard time understanding why my javascript code refused to run in the console. i would really appreciate the help. thanks

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. You might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. You can find the curriculum at https://www.freecodecamp.org/learn.

With your current questions, we don’t have enough context to know what you already know or don’t know.

It is pretty typical on here for people to share a codepen / repl.it / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:

<script>
		document.addEventListener('DOMContentloaded', function() {
		document.querySelector('form').onsubmit = () => {
				const task = document.querySelector('#task').value;
				console.log(task);
				//stop form from submitting
				return false;

			}
		})

	</script>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

okay. thanks for the help

We probably need to see your HTML as well. The best thing to do would be to put this all in codepen and give us a link. But we are open to other alternatives :slight_smile:

okay. thanks, i will get right on it

here is the link

It’s DOMContentLoaded not DOMContentloaded (the ‘L’ is uppercase).

1 Like

Thank you so much!!! i really appreciate the help. thank you :grinning_face_with_smiling_eyes:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.