【问题标题】:move text three before the input tag the checkbox is not disappearing在输入标签之前移动三个文本复选框不会消失
【发布时间】:2018-04-02 22:48:18
【问题描述】:
  • 如果我将文本移动到输入标记之前的三个位置,则第三次单击时复选框不会消失。
  • 但是当我在输入标签后保留三个文本时,它工作正常。
  • 你能告诉我如何解决它吗?
  • 在下面提供我的代码

https://stackblitz.com/edit/angular-w6tqvn?file=app/app.component.html

<label [ngClass]="{'is-multiple-of-3':multipleOf3}">
    <span  id="redSquare"></span>
three
<input type="checkbox" name="rememberLogin" id="buttonId"  (click)="open()"> 
</label>

【问题讨论】:

  • 如果你想隐藏复选框,[hidden] 属性可能更有用

标签: javascript jquery html css angularjs


【解决方案1】:

在输入框之前保留文本并不是不起作用。这是因为在第一种情况下,您提供类来标记,而在其他情况下,您提供它来跨越。所以只需提供 [ngClass] 来标记

<label [ngClass]="{'is-multiple-of-4':multipleOf4}">
    <span id="redSquare4"></span>
    <input type="checkbox" id="39" name="DownlinkSource" (click)="downlinkCheckBoxClick()"/> 
     4
</label> 

【讨论】:

    【解决方案2】:

    如果你说的消失是显示红色方块, 您应该将 span 移到文本“三”之后。

    <label [ngClass]="{'is-multiple-of-3':multipleOf3}">
        three<span id="redSquare"></span>
        <input type="checkbox" name="rememberLogin" id="buttonId"  
        (click)="open()"> 
    </label>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-28
      • 2016-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多