Logo

Bulletin Board

Java Script help - get element by tag name
Started by a.smith
04 Jul 2012 20:33
SUBSCRIBE
Avatar
a.smith (204)
04 Jul 2012 20:38
How do i make something where it displays all the elements CSS classes in one string? example,

<myelementname class='classone'></myelementname>
<myelementname class='classtwo'></myelementname>

so how could i make a string saying 'classone, classtwo'? all i need is them to be in their. doesnnt matter if theirs numbers, commas, anything. any help?

note - their will be more than two elements. i want it to automaticly display them all.
Avatar
M.J kInG (1217)
23 Jul 2012 00:13
Trying to understand yr comment.
You mean this?


Example

.MyElement {
}

Please comment if incorrect answer to your question.
Founder and CEO of DsiRealms
Avatar
GuitarBoy (178)
27 Nov 2012 03:53
var class=null;
var s=document.getElementsByClassName("myClass");
for(var x=0; x<s.length; x++){
class+=s[x].className+" ";
}
Success today, greatness tomorrow.
Home Forum Home
Wii, Nintendo DS, Nintendo DSi are ™ Nintendo Co. Ltd. Opera is a product of Opera Software ASA. This website is ©2009-2012 Daniel Gump. All rights reserved. Members are responsible for their own content. No account information will be given to third-parties.