problem
using jquery on angular 7 not working and not make red to different rows ?
I using jquery on angular 7 but when using this jquery code not working
- import { Component, OnInit } from '@angular/core';
- import * as $ from 'jquery';
- @Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
- })
- export class AppComponent implements OnInit {
- title = 'TestIndexSolution';
- constructor() {
-
- }
-
- ngOnInit() {
-
- $(function () {
-
- $("#table1").find("tr").each(
- function () {
- var tds = $(this).find("td");
- var value = tds.eq(0).text();
- tds.each(
- function () {
- if (this.innerText != value) {
- tds.css("color", "red");
- return false;
- }
- }
- )
- }
- )
- })
-
- }
- }
- <html>
- <head>
- <script src="Scripts/jquery-3.3.1.min.js">script>
- <head>
- <body>
- <table border="1">
- <col width="500">
- <col width="500">
- <col width="500">
- <col width="500">
- <tr bgcolor="#6699FF" width="100%">
- <th>Part1</th>
- <th>Part2</th>
- <th>Part3</th>
- <th>Part4</th>
- <tr>
- <td>12</td>
- <td>12</td>
- <td>12</td>
- <td>12</td>
- </tr>
- <tr>
- <td>12</td>
- <td>15</td>
- <td>12</td>
- <td>12</td>
- </tr>
- <tr>
- <td>17</td>
- <td>15</td>
- <td>12</td>
- <td>12</td>
- </tr>
- </table>
-
- </body>
- </html>