I am implementing a hierarchy of spans to define different layers of annotations:
<span class="eventRel" id="e12-e32">
<span class="event">
<span class="hl" id="moh">
soluzione
<span style="width:500px;">
tokenid: 11
</span>
</span>
</span>
</span>
Next, I have various controllers in place to highlight the token using the background property (in this case: soluzione
) with different colors.
However, my code works perfectly when there is only one span layer above the class="hl".
Sometimes, there are instances where there are more than 3 spans above the class="hl".
To make it work, I use the following code snippet:
document.getElementById('e12-e32').style.backgroundColor='white';
This solution only works under specific conditions:
<span class="event">
<span class="hl" id="moh">
soluzione
<span style="width:500px;">
tokenid: 11
</span>
</span>
</span>
If you can provide assistance in this matter, it would be greatly appreciated. Thank you in advance.
Now, to achieve the desired result of highlighting the word soluzione
, I need to apply the following style:
<span class="eventRel" id="e12-e32" style="background-color:yellow;">
<span class="event">
<span class="hl" id="moh">
soluzione
<span style="width:500px;">
tokenid: 11
</span>
</span>
</span>
</span>