Hide the content within a table row by setting the display to

I need to hide the div with the id "NoveMeses" if all h3 elements display "N.A." Is there a way to achieve this?

If both h3 elements in row1 and row2 contain the text "N.A.", I want the div NoveMeses to be hidden.

Below is the code snippet using AngularJs:

<div id="NoveMeses" data-ng-if=$odd class="tableRowOdd" data-ng-show="item.TipoOWS === '9M'">
          <div class="tableCellContent20">
                   <h3 class="cellTextType" ><span>{{::item.TipoCalculado.split('#')[1]}}</span></h3>
          </div>

          <div id="row1" class="tableCellContent20">
                   <h3 class="cellTextValue" data-ng-show="item.TipoOWS !== 'Datas'"><span>{{::item.Last.replace('.',',') | limitTo:7:0}}</span></h3>
                   <h3 class="cellTextValue" data-ng-show="!item.TipoOWS !== 'Datas'"><span>N.A.</span></h3>
          </div>

          <div id="row2" class="tableCellContent20">
                   <h3 class="cellTextValue" data-ng-show="item.TipoOWS !== 'Datas'"><span>{{::item.LastUm.replace('.',',') | limitTo:7:0}}</span></h3>
                   <h3 class="cellTextValue" data-ng-show="!item.TipoOWS !== 'Datas'"><span>N.A.</span></h3>
          </div>
</div>

Answer №1

If I understand correctly, you are looking to hide the NoveMeses div if the text within the span element of your h3 is "N.A."

To achieve this, you can use a simple JavaScript code like the following:

var nove_meses = document.getElementById('NoveMeses');
var h3s = document.querySelectorAll('.cellTextValue span');
for(var i = 0; i < h3s.length; i++) {
console.log(h3s[i].innerText);
if(h3s[i].innerText === 'N.A.') {
nove_meses.style.display = 'none';
}
}
<div id="NoveMeses" data-ng-if=$odd class="tableRowOdd" data-ng-show="item.TipoOWS === '9M'">
    <div class="tableCellContent20">
        <h3 class="cellTextType" >
            <span>{{::item.TipoCalculado.split('#')[1]}}</span>
        </h3>
    </div>
    <div id="row1" class="tableCellContent20">
        <h3 class="cellTextValue" data-ng-show="item.TipoOWS !== 'Datas'">
            <span>{{::item.Last.replace('.',',') | limitTo:7:0}}</span
        </h3>
        <h3 class="cellTextValue" data-ng-show="!item.TipoOWS !== 'Datas'">
            <span>N.A.</span>
        </h3>
    </div>
    <div id="row2" class="tableCellContent20">
        <h3 class="cellTextValue" data-ng-show="item.TipoOWS !== 'Datas'">
            <span>{{::item.LastUm.replace('.',',') | limitTo:7:0}}</span>
        </h3>
        <h3 class="cellTextValue" data-ng-show="!item.TipoOWS !== 'Datas'">
            <span>N.A.</span>
        </h3>
    </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ensuring security against cross site scripting attacks on window.location.href

Currently, I'm utilizing window.location.href to redirect the page to an external URL: <Route exact path={rootUrl} component={() => { window.location.href =`https://${window.location.hostname}/www/testurl?google=true`; return null; }} /> How ...

JQuery Mobile: Adding fresh, dynamic content - CSS fails to take effect

I've encountered this issue before, but I'm still struggling to resolve it. When adding dynamic content to a page (specifically a list-view), the CSS seems to disappear once the content is added. I've tried using the trigger("create") functi ...

Using AngularJS, I have successfully captured the value of a button and the data ID from an HTML response, which I then sent to a Spring

I am currently working with Spring MVC, AngularJS, and MongoDB. This is quite new to me. I have a HTML page where I need to display task names, owner names, and accept/reject buttons. When the accept or reject button is clicked, I need to send the correspo ...

Update your content dynamically by refreshing it with JQuery/AJAX following the usage of an MVC partial view

Implementing the following JQuery/AJAX function involves calling a partial view when a selection is made in a combobox labeled "ReportedIssue" that resides within the same partial view. The div containing the table is named "tableContent". <script type ...

What is the solution for resolving the Next.js 14 next/link routing 404 error page problem?

After performing a fresh installation of Next.js on Windows using an elevated shell with the command npx create-next-app@latest, I encountered an issue. In my /src/app/components/Header.tsx file, the code looks like this: import React from 'react&apos ...

Issues with reloading when passing POST variables through Ajax requests

I have a button with the id #filter <input type="button" name="filter" id="filter" value="Filter" class="btn btn-info" /> Below is the Ajax script I am using: <script> $(document).ready(function(){ $('#filter').click(function() ...

Troubleshooting: The Jquery each loop is malfunctioning

I am new to using jquery and I have encountered a problem in my project. I am attempting to iterate through all the links within the #rate_box and attach a click event to them. This click event is supposed to send data to an external php script, then remov ...

Tips for implementing a custom filter in an AngularJS JavaScript controller

Can anyone help me with creating a custom filter in an AngularJS JavaScript controller? I need to be able to search for items in an array called segments by their SegmentId. The filter should iterate through the segments array and return the segment that ...

Exploring the World of Dynamic Table ID Access in Rails 5 with Coffeescript

Within my Index view, I have a table that I want to dynamically populate with an ID. This is what I've attempted so far: id="table_<%= @controller_name %>" The method in my controller looks like this: def get_controller_name @controller_nam ...

What are some creative ways to enhance closePath() in canvas styling?

Currently, I am faced with the challenge of styling the closePath() function on my canvas. Specifically, I would like to apply different stroke styles to each line segment. For now, let's focus on changing colors for each line. In the example below, y ...

Is there a way to change my curl command into an AngularJS HTTP request?

Looking to translate the following curl command into an Angular http request. The command appears as follows: " curl -X POST --data 'username=myusername&password=mypassword' -i " When using HTTPS, should I use GET or POST? Any assistance w ...

What is the process for including a checkbox with a label in Card Media?

I attempted to create this feature using code. However, I encountered an issue where the CardMedia and the checkbox would not align properly, resulting in a lack of responsiveness. <Card> <CardMedia ...

What would be more efficient for designing a webpage - static HTML or static DOM Javascript?

My burning question of the day is: which loads faster, a web page designed from static html like this: <html> <head> <title>Web page</title> </head> <body> <p>Hi community</p> </bo ...

What is the best way to display a div based on a keyword match?

If the keyword search results in a match, I can display the corresponding input text and its related category div. Now, I am attempting to also search through category names. If the searched keyword matches a category name, that specific div should be visi ...

Utilizing Promise.all to update subdocuments with Mongoose

Encountered an error while checking the value in promiseArr, seeking assistance or suggestions for a better approach. Thanks! **Error** <rejected> { MongooseError: Callback must be a function, got [object Object] at new MongooseError (D:\P ...

Sending Parsed Information to Callback for Flexible Use

Is there a way to pass the value of coins, or even better, currency to my callback function so I can freely use the parsed JSON data in other functions? function fetchJSON(path, callback) { var jsonReq = new XMLHttpRequest(); jsonReq.onreadystatechang ...

Modify the text on a button using vanilla JavaScript

Although it may seem like a simple question, I am struggling to change the text on my button. The code for my button in the web browser console is: <button class="nav-link active" id="coholder-tab" data-toggle="tab" data-t ...

Animating SVGs in Internet Explorer (IE)

I'm currently working on an animation project using SVG images and JS, but unfortunately, I've run into a roadblock with SVG animations not functioning correctly in Internet Explorer. Do you happen to know of any solutions that could make it work ...

Choosing the subsequent element that comes before

<tr class="main"></tr> <tr class="emails-details"> <button>some button</button> </tr> <tr class="main"></tr> <tr class="emails-details"> <button>some button</button> </tr> &l ...

What is the best way to display table rows for a specified date range?

I am working with a table and need to display only the rows that fall between two specific dates. <table id ="Table"> <thead> <tr> <th>Date</th> <th>Name</th> <th>Desc</th> </tr> </thead> ...