Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
devTea219106yYou mean creating the html with js dom instead of vanilla syntax? Usually I only render a “repetitive” elements or if it’s controlled through ajax
-
@devTea Yeah, that's exactly what I meant. I was slightly preoccupied when I posted.
Basically right now on a little thing I'm working on, I have 5 divs in a row. They all have the same elements in them, and I just wanted some opinions on using JS DOM to create the elements -
@M1sf3t Nah, it's more of "I don't want these ~75 lines in the HTML file when I can have like 15 in the JavaScript that creates those 75"
But I'm just asking for opinions right now -
devTea219106y@infernalempress if it can be dynamicaly programmed by js then go for it, that’s the use of it isn’t it?
-
@devTea You have a very good point. I think what I'll do is write it, then see if it makes any difference at all on load times or anything. It'll have to be tomorrow tho. I have to meet with my "study buddy" today cause we're both on the verge of not graduating.
-
tkdmatze4406y@infernalempress
have them once as a template and make the others by copying and manipulating -
devTea219106y@infernalempress speed isn’t going to be a problem, backward compatibility is if you’re using a newer syntax, you could use old js syntax for looping simple html
-
Maybe I completely misunderstood the subject, but if it's what I'm thinking, there's a very good course on Pluralsight about creating kind of a framework using js classes to render the html (extending the html element)
Related Rants
Got a question for any web devs on here.
How would you feel about making elements in JavaScript (if you have some divs that are exactly the same) rather than having all of them in the HTML source file?
question
webdev