In order to apply some style fixes to the Infowindow, I am trying to select the element with the class 'gm-style-iw'. This selection process is taking place within an angularjs directive.
<div ui-view="full-map" id="full-map" class="mainMap col-xs-6"></div>
The ui-view loads a directive containing IW content, and the map is initialized inside that directive.
When initializing the controller of the directive, I need to modify the element with the class 'gm-style-iw'.
var iwElem = $document[0].getElementsByClassName("gm-style-iw")
This code snippet correctly returns the desired element.
console.log(iwElem) shows:
[]
length: 1
0: div.gm-style-iw
__proto__: HTMLCollection
However, I am facing issues after this point. The iwElem
variable is an HTMLCollection
, which signifies an array of HTML elements. According to my understanding, I should be able to access the first element using iwElem[0]
. Strangely enough, iwElem[0]
returns undefined
.
I also attempted to use jQuery selectors:
$('.gm-style-iw')
=> length:0
$('div.gm-style-iw')
=> length:0