javascript - getElementsByTagName inside GetElementById (object xraywrapper)? -
i trying div
inside div
, since id of second div
variable, use
var wrappingdiv = document.getelementbyid('divid')
to wrapping div then
var insidediv = wrappingdiv.getelementsbytagname('div')
but getelementsbytagname
not function error, guess syntax wrong, guys put me in right direction?
thanks in advance.
edit : correct myself, trying body of gmail email, :
var element = content.document.getelementsbyclassname("ii gt m13fbe3a51e95e196 adp ado");
it returns object xraywrapper[object htmlcollection]
edit 2 :
i using mozilla firefox, , developing own extension, access source code of google mail use simple javascript (content.document...)
in
var element = content.document.getelementsbyclassname( "ii gt m13fbe3a51e95e196 adp ado");
getelements
<- s
means returns multiple elements (in list-like collection), not 1 element.
you might want pick out first 1 found.
var element = content.document.getelementsbyclassname( "ii gt m13fbe3a51e95e196 adp ado")[0];
there small risk might not m13fbe3a51e95e196
on every page, or forever. perhaps should generalise search bit. how searching class "adp"
?
Comments
Post a Comment