I want to change the color of the ion-checkbox in the typescript
<ion-item >
<ion-label id="check1">No</ion-label>
<ion-checkbox color="blue" id="box1" [(ngModel)]="todo.check1" name="check1"></ion-checkbox>
</ion-item>
I try this:
document.getElementById("box1").color = "dark";
but it doesn't work
I also try to change the class: doesn't work
Thanks for you help
try:
document.getElementById("box1").setAttribute("color", "dark")
or
document.getElementById("box1").style.color = "dark"
The first will change the color attribute of the element, while the second changes the css style for color of the element.
For typescript to be happy, you may also have to cast the result of your getElementById
call. I.E.
(document.getElementById("box1") as HTMLElement).style.color ...