我有两个单选按钮,"是"one_answers"否"和一个文本字段。如果用户单击"是",那么禁用的文本字段将启用并且是必需的。我想文本字段的边界是红色时需要,并创建了一个类来做到这一点。我还创建了一个类,使文本字段成为灰色,以便在填充字段后使用。我的问题是如何正确应用所需的类,然后在文本字段上应用验证过的类。
我下面的解决方案涉及在blur方法中添加一个函数,这似乎是有效的。问题是,如果我决定点击"不"然后再点击"是",红色边框就不显示了。
关于如何解决这个问题或如何优化我的代码的任何建议将不胜感激。谢谢你!