How to decrease the values using a function

前端 未结 3 1501
终归单人心
终归单人心 2021-01-27 23:05

Hey there actually i made a an html page on which there are two portion when i click in first portion the number increases and when i click in second portion the number in secon

3条回答
  •  自闭症患者
    2021-01-27 23:45

    Your button has no functionality attached to it.. The problem is here:

    -

    ng-click="addPoint(-1)"

    you'll have something like

     

    -

you need to add negative one when they click the button.

also change

to just or

Update: The problem is here!

-

you have the h3 nested inside the addPoints element. you can not click on the h3 element without clicking on the addPoint element.

because the h3 is a child of the addPoints. You NEED to remove it
you can still position it in the same place but when its not nested.

 

-

then add the appropriate javascript logic. i would change addPoint() to addPoint(element_number, points_to_add)
so you do addPoint(1, -1)

actually i would change all the code.

提交回复
热议问题