javascript - chaining using getElementsByClassName -


<script> var elms = document.getelementbyid("contentwrapper").getelementsbyclassname("pbsubheader brandtertiarybrd tertiarypalette"); console.log(elms); (var i=0; i<elms.length; i++) { console.log(elms[i]); } </script> 

when try using getelementsbyclassname see no logs related second console.log message. first console.log gives me

[item: function, nameditem: function] 0: div#head_01bd000000wqj9k_ep.pbsubheader.brandtertiarybrd.tertiarypalette head_01bd000000wqj9k_ep: div#head_01bd000000wqj9k_ep.pbsubheader.brandtertiarybrd.tertiarypalette length: 1 proto: htmlcollection

how further drill down head_01bd000000wqj9k_ep , firstchild of class pbsubheader brandtertiarybrd tertiarypalette

someone please correct me if not chaining correct. in advance

you can use document.queryselectorall("#contentwrapper .pbsubheader, #contentwrapper .brandtertiarybrd, #contentwrapper .tertiarypalette") aware function isn't supported in ie7 , lower.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -