When selecting a checkbox show an input with ionic

Hello, everyone!

I’ve been looking for a long time and haven’t found anything like it. I want a function in typescript that when selecting a checkbox a text input appears next to it to enter numbers.

Ionic tags:

<button (click)="toggleShow()" type="checkbox" >show/hide</button>
<div *ngIf="isShown" class="row container-fluid"  id="divshow" >
Div Content

Typescript function:

isShown: boolean = false ; // hidden by default

toggleShow() {

this.isShown = ! this.isShown;


So far I have this, but when selecting a checkbox, the text input appears in all the others.

The thing I don’t understand… it is why you use “this” to reference a textbox… Because I don’t know how similiar is typescript to javascript (it looks like a lot if not the same). But I assume that this refers to the current object… and that would be the checkbox. That’s where you’re applying your fucntion.

And that’s not what you want…you want to target a different object, the text box … or am I wrong?

I got that code from the internet and it was the closest thing I’ve found. The bad thing is that if I press a checkbox all of them are pressed, I suppose it is because they call the same function.

I want a text box to appear next to the checkbox when it is selected.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.