DEV Community

loading...

Discussion on: HTML output element

Collapse
costinmanda profile image
Costin Manda

It seems to me that this is like a readonly input, exposing a value that you can change and apparently forcing itself in the window object even if you specify the name attribute. If you replace it with a span that has an id="output" and the .value to .innerHTML in the Javascript, it works just as well.

I see it more useful if we can specify a type, like the input has. It is interesting you mentioned the option to define a combination of inputs, but you have not used it :) Something like for="price vat".

Thread Thread
dailydevtips1 profile image
Chris Bongers Author

Hey, yeah I think it's like many semantic HTML, people tend to make their own options, but why?

We have all this semantic HTML for a reason, I would think.

As for the for the label, indeed, I choose not to show it, because to me it was confusing if that was causing the output value.
So wanted to not dive into that for this guide, but maybe I should state it as the full version.

Thread Thread
mzaini30 profile image
Zen

I usually create my own HTML tag, like <hello></hello>. Then, I manipulate with document.querySelector("hello").innerText = "World"

Thread Thread
dailydevtips1 profile image
Chris Bongers Author

To what advantage?
I don't quite know how a custom tag benefits you?

Thread Thread
mzaini30 profile image
Zen

For simplify writing. So, I don't write <div class="hello"></div>. Just <hello></hello>

Forem Open with the Forem app