Is there such thing as a Nu Html Checker for javascript?
Iâm not sure about a site that does it. There are any number of linters out there that will validate you code - jslint, jshint, others
You can add these as a plugin to your code editor. Codepen has one built in that will provide feedback on your code quality.
Personally, Iâd start with looking at the Codepen one - itâs available in the drop-down on the JS editor; just select âAnalyze JSâ
Would you consider this javascript if you put it in html section?
<button onclick="document.getElementById('player').volume=1.0;player.play()"></button>
<button onclick="document.getElementById('player').volume=1.0;player.paused ? player.play() :player.pause()"></button>
I donât think Codepen would recognise that as JavaScript if you put it in the HTML box. You need to separate them out.
Is there such thing as an inline javascript / html checker?
Not that I have ever heard of. It may exist, but I canât see any mileage on anyone spending time on creating it - there isnât a market for it, as the vast majority of developers just donât code that way.
no because they are two different languages and so whichever one you are validating the other one will be invalid.
Inline code is antiquated and hasnât been needed since Netscape 4.
Properly written JavaScript canât interact with inline scripts because they will be in different scopes.
With proper security headers in place on the hosting no inline scripts will run - you will just get a security violation error.
This works: When I removed a question mark or a period, it told me error.
https://html5.validator.nu/
The document is valid HTML5 + ARIA + SVG 1.1 + MathML 2.0 (subject to the utter previewness of this service).
I thought you were trying to check your JavaScript?
I was able to check the inline javascript using this. https://html5.validator.nu/
It works.
How are these different from each other?
The html5 one was able to check the inline javascript, the other one doesnât.
https://html5.validator.nu/ / https://validator.w3.org/nu/#textarea
The one that rejected the inline junk is validating properly - the other one isnât.
The one that rejected the junk is the official standards validator - the other one has no official standing and could have been written by anyone to validate anything.
Correction: the nu/ shouldnât be there - the standards validator is what you get if you get rid of that. You also need to remember that the validator is validating against what browsers are expected to accept including web pages written over 20 years ago - they donât validate what you should be using now. The JS linters such as jshint and jslint do validate JavaScript properly.
I removed a period and a question mark from the code.
This One Found Errors: This one said the code was not written properly.
https://html5.validator.nu/
This One Found No Errors: This one said the code was written properly
https://validator.w3.org/nu/#textarea
Nevermind, both https://html5.validator.nu/ and https://validator.w3.org/nu/#textarea check inline javescript.
I tried the other one again, and it made corrections. So, I guess they both do then.
What do you mean?
the nu/ shouldnât be there
When it comes to the English language, a dictionary will tell you if youâve spelled the word correctly, whereas a grammar checker will help you to figure out if your words make sense in context with each other.
The validator is equivalent to a dictionary, whereas a linter is more like a grammar checker, and a teacher of the native language can give you the best advice of all of them.
I take it that you are satisfied just with the validator?
Al I care about is if the code is written correctly.
If all of these characters are in the right spots.
():.?;
Both: https://html5.validator.nu/ / https://validator.w3.org/nu/#textarea do this.
[quote=âasasass, post:17, topic:230015, full:trueâ]
Al I care about is if the code is written correctly.[/quote]
Correctly according to the validator, the linter, or the helpers here on the forum?
the linter doesnât do that at all.
Linters are a code quality tool.
Some linters do a better job than others. For example, jslint is so harsh in its criticism that it brings grown men to tears.