【问题标题】:How to change style of Parent div if the radio input is checked in Reactjs?如果在 Reactjs 中检查了单选输入,如何更改父 div 的样式?
【发布时间】:2021-06-13 13:46:12
【问题描述】:

如果检查了相应的无线电输入,我想将教员项目 (.faculty) 的背景颜色更改为红色,并且应该在 Reactjs 中使用 onChange 方法来完成。我是 reactjs 的初学者。提前致谢。

<div className="faculties">
 <div className='faculty '>
  <label htmlFor="faculty1">Science
   <input type="radio" id='faculty1' name="chooseFaculty" />
  </label>
</div>
<div className='faculty '>
  <label htmlFor="faculty2">Management
   <input type="radio" id='faculty2' name="chooseFaculty" />
  </label>
</div>

</div>

【问题讨论】:

标签: html css reactjs


【解决方案1】:

你想要this这样的东西吗?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-02
    • 1970-01-01
    • 2012-06-06
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 2018-11-09
    • 1970-01-01
    相关资源
    最近更新 更多