Reputation: 3530
I'm trying to hide a layer but can't seem to figure out how to get this working here's what i'm trying
if ($('#dgAvailable_ctl02_lblpricefrom > strong').text() == '£'){
$('#dgAvailable_ctl02_lblpricefrom').parent().parent().hide()
}
And my code is
<div class="resultsitem" style="background-color: rgb(238, 229, 208);">
<div class="petspeoplecontainer">
<h5><span class="lblpricefrom" id="dgAvailable_ctl02_lblpricefrom"><br>From <strong>£</strong></span></h5></div>
</div>
So i'm trying to hide the layer resultsitem
if the text of dgAvailable_ctl02_lblpricefrom
= £
Any help would be appreciated
Thanks
Jamie
Upvotes: 2
Views: 210
Reputation: 33857
The first parent of pricefrom is the h5 and then the container div. What I think you might want is:
$('#dgAvailable_ctl02_lblpricefrom').parents("div.resultsItem").hide();
I'd also note that hard coding your asp.net control IDs like this may cause you problems down the line...
Upvotes: 0