I have a group of hidden elements with the class name "asd" and I want to select only one using jQuery, but the .text() method doesn't seem to work even when an object is returned by the filter method. Other jQuery methods also do not yield the desired result. Here's my code:
<script>
$(document).ready(function(){
alert($("#vetrina > :hidden").filter(".asd").text());
});
</script>
HTML:
<div id="vetrina">
<div class="blocco" class="1">
The text I don't need
</div>
<div class="blocco-inv" class="asd">
THE TEXT I WANT TO RETRIEVE
</div>
<div class="blocco-inv" class="3">
The text I don't need (still hidden)
</div>
</div>
CSS:
<style>
#vetrina{
width: 100%;
background-color: none;
display: table-row;
}
.blocco{
display: table-cell;
margin: 15px;
border: 2px solid lightgrey;
position: absolute;
display: inline;
}
.blocco-inv{
display: table-cell;
margin: 15px;
border: 2px solid lightgrey;
position: absolute;
display: none;
}
</style>