[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 / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
js Help!
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

Thread replies: 17
Thread images: 2
File: Unknown.png (5 KB, 225x225) Image search: [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: [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

banner
banner
[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 / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.