[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]

js Help!

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: 17
Thread images: 2

File: Unknown.png (5KB, 225x225px) Image search: [Google]
Unknown.png
5KB, 225x225px
<div id=“theone-aaa”>
<div id=“theone-bbb”>
<div id=“theone-ccc”>

var this = $(‘#theone-???’);

How can I get all div id's with the prefix "#theone-" but a different suffix to change the variable within a loop. So if a id was "theone-aaa" the variable became the same.
>>
why the fuck wouldn't you just give them all a class? that's the whole point of classes.
>>
Use a fucking class
>>
How would you do this if they were class' then?
>>
there page id's and thats why not a class
>>
>>52410835
please go do a basic html and javascript tutorial somewhere else.
>>
>>52410703
[].forEach.call(document.querySelectorAll("[id^='theone-']"), function(variable_within_a_loop) {
do { console.log("OP IS A FAGGOT") } while(1);
});
>>
>>52410949
will do
>>
>>52410703
What the fuck.

document.querySelector('[id^=theone-]')


then you iterate the result and do whatever the fuck you're trying to do. I can't understand your half-assed question about "the variable", use a regexp to strip the prefix from the id in the loop.

Learn how to ask a fucking question.
>>
>>52410703
for assholes like you, people hates javascript, this is not a fucking JAVASCRIPT question, its a jquery question fucking retard.
>>
>>52410703
>jqueery
>>
>>52411062
You're as bad as the OP, just like him, you don't know that this doesn't require jquery at all.
>>
File: 1360514401164.gif (2MB, 348x323px) Image search: [Google]
1360514401164.gif
2MB, 348x323px
>>52410989
I like this guy.

He's got like the worst possible solution, showed up after all the people saying "use a class," and gets super angry about it anyway.

Sir, you truly have found the perfect site to be posting on. Welcome home.
>>
>>52410703
Needs more jquery
>>
>>52411148
You would be best served by using a class, my profoundly ignorant and likely learning-disabled comrade.
>>
>>52411111
listen to the quints!
Thread posts: 17
Thread images: 2


[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.