In my HTML file, I have multiple <span>
elements with the class of temp_val
that include a 1
value which I need to hide. These elements are placed throughout the document.
Below is an excerpt from my HTML code:
<div class="row" style="float: left; width: 80%; margin-top: 10px; ">
<strong>
<span class="temp_val">Value1</span>
<span style='visibility:hidden' class='temp_val_name'>1</span>
</strong><br>
<font size="2">
<img src="assets/images/maps.png" height="12" width="7" style="vertical-align: middle;" >Image1
<span style='visibility:hidden' class='temp_val_name'>1</span>
<img src="assets/images/earphone.png" height="12" width="10" style="vertical-align: middle;" >Image2
<span style='visibility:hidden' class='temp_val_name'>0</span>
<img src="assets/images/envelope.png" height="11" width="14" style="vertical-align: middle;">Image3
<span style='visibility:hidden' class='temp_val_name'>1</span>
</font>
</div>
I tried using jQuery to hide these elements but it isn't working as expected. Below is the code snippet:
$(".temp_val_name").each(function() {
if ($(this).text() == '1') {
$('.temp_val').hide();
}
});
I also attempted another approach with jQuery, but encountered the same issue:
if($('.temp_val_name').text() == '1') {
$('.temp_val').hide();
}
This is just a portion of the elements that need to be hidden within the document. How can I resolve this issue?