K
K
KOPC18862014-12-10 18:40:30
Angular
KOPC1886, 2014-12-10 18:40:30

How can I change the class and checked attribute when clicking on a div?

Hello!
There is such layout

<div class="not_show" id="notShow" ng-click="notShow()">
        <span class="checkPrompt" ng-class="{'hide': checkedPrompt}" id="check"></span>
    </div>
    <input type="checkbox" ng-checked="checkedPrompt" class="checkBox" id="notShowCheck" hidden="hidden">

How can I make span.checkPrompt appear/disappear when clicking on the #notShow div and change the checked attribute of input#notShowCheck ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2014-12-11
@cjbars

Like something like this

<div class="not_show" id="notShow" ng-click="showSpan=!showSpan">
        <span class="checkPrompt" ng-show="showSpan" id="check"></span>
    </div>
    <input type="checkbox" ng-checked="showSpan" class="checkBox" id="notShowCheck" hidden="hidden">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question