Reputation: 755
How do I get the div id based upon the value "IBC-CW1 -DE-02A"
<div id="main">
<div id="hotspot1" class="drawing" data-canvas-width="89.91394117538998" style="left: 1397.52px;top: 1071.92px;font-size: 10.7966px;font-family: monospace;transform: scaleX(1.01043);background-color: #ff0000;">IBC-CW1 -DE-02A</div>
</div>
If i use parentnode means I am getting id="main"
How do i get hotspot1
Update:
var spot.hotspot_hover = "IBC-CW1 -DE-02A"
$(".textLayer").each(function(){
$('.drawing').css('background-color','transparent');
if($(this).html().indexOf(spot.hotspot_hover) > -1){
var cont_redirect = $(this).parent()
console.log(cont_redirect[0])
$(cont_redirect).css('background-color','#ff0000');
$('#content-wrapper').animate({scrollTop: cont_redirect[0].offsetTop+300},'slow');
}
});
Now I have to give background color for that content
Upvotes: 0
Views: 44
Reputation: 36
Try the follwing jquery code
var divId = $("div.drawing:contains('IBC-CW1 -DE-02A')").attr('id');
console.log(divId);
Upvotes: 1