Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

How to select HTML/ionic element in js?

$
0
0

@pjhartin wrote:

Hi All,

I have been using ionic 2 for a few weeks now and love it. However, I'm not sure of the best practice to perform the following.

I have an custom ion-card that contains a button which fills the entire element so that it is clickable (as below)

  <ion-card class="schedule-card" *ngFor="#session of group.sessions">
  <ion-card-content class="content">
    <ion-item-sliding>
      <button ion-item (click)="goToSessionDetail(session)">
        <div class="container">
          // Removed to simplify example
        </div>
      </button>
    </ion-item-sliding>
  </ion-card-content>
</ion-card>

What I am trying to achieve is that when the button is pressed, the background-colour of the parent ion-card class 'schedule-card' changes. I am very lost how to do this however. Any help would be greatly appreciated.

p.s. The reason I want to change the ion-card bg and not the button's bg is due to the css design e.g.

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>