I want to require that a checkbox be checked on a Community form. I am able to display an alert when it isn't checked. I don't want to do that. I want to display text on the form. I think I should be able to do this by dynamically adding CSS. I don't know how to do that. Pointers?

    var legalChecked = component.find("legalnotice").get("v.value");
    if(!legalChecked) {

1 Answer 1


I am able to use $A.util.addClass(legalNotice, 'hasborder') and `$A.util.removeClass(legalNotice, 'hasborder') to accomplish the dynamic application of CSS

  • 1
    Please use the edit link on your question to add additional information. The Post Answer button should be used only for complete answers to the question. - From Review
    – Derek F
    Commented Feb 17, 2020 at 20:15
  • Using addClass is the answer that I found to my problem. Commented Feb 18, 2020 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .