[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vip /vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
js Help!
If images are not shown try to refresh the page. If you like this website, please disable any AdBlock software!

You are currently reading a thread in /g/ - Technology

Thread replies: 17
Thread images: 2
File: Unknown.png (5 KB, 225x225) Image search: [iqdb] [SauceNao] [Google]
Unknown.png
5 KB, 225x225
<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 (2 MB, 348x323) Image search: [iqdb] [SauceNao] [Google]
1360514401164.gif
2 MB, 348x323
>>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 replies: 17
Thread images: 2
Thread DB ID: 424432



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

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

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 shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at [email protected] with the post's information.