JavaScript
What do you deem as okay? Native JS, no JS, Ajax or jQuery or hipster library's? I try to avoid javascript but sometimes it's better for normie users. Why can't we have a web without faggot.js?
I want to add an event listener to multiple elements using a loop.
for (int i = 0; i < numofelements; i++{
getElementById(name + i).addEventListener("click",function{
doSomething(i);
})
}
function doSomething(a){
console.log(a);
}
Now why is it that it doesn't remember the value of i when I first added it and uses the last known value of i. How do I get around this.
>>58962514
I like angular but anons on here will claim all js shit bloatscript
>Why can't we have a web without faggot.js?
Because the only people who work on webdev are the people too stupid to understand what they're doing to begin with, so you end up with 685 libraries that all half-do what you want and 13 frameworks written by people who, again, do not know what they're doing.
It is developed and maintained by idiots.
>>58963025
I've never needed anything more than jQuery desu. Angular sites I've visited all take a while to load. Sometimes you see the {{ VARIABLE }} shit when it doesn't load fast enough.
That might be the result of stupid monkeys, but that shit turned me off using some big framework.
>>58963192
Angular is slow to load. The {{variable}} thing can be hidden easily though, so it's probably just lazin/an oversight. It offloads most back end processing to the frontend, so it's hard to not break the site if js is disabled with angular. You often either have to make an alternative non js site or not use angular.
I think there's a special ring of hell where only pure javascript is allowed
>>58962997
In addEventListener assign i to a new var and pass it in