[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

JavaScript What do you deem as okay? Native JS, no JS, Ajax

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 1

File: 1454172698761.png (20KB, 385x317px) Image search: [Google]
1454172698761.png
20KB, 385x317px
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
Thread posts: 8
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.