Reputation: 1
I'm using Parsley in my form, so when an email address is being entered and this is a wrong syntax you will get an error message, when it is correct you will get a success message.
This all works fine, but i would like to add a class to a parent. As you can see in the code below the input has a class called parsley-error.
When that class is in the input i want to add a class on the class block-1.
<div class="block-1 border-left">
<div class="radio item-1"></div>
<div class="form-group" data-popover-name="popover-paragraph-template">
<div class="form-group" data-popover-name="popover-field-template">
<div id="componentHider">
<input type="email" data-parsley-email="" id="email" name="email" class="form-control parsley-error" placeholder="Nieuw e-mailadres" data-parsley-id="3622">
<ul class="parsley-errors-list filled" id="parsley-id-3622"></ul>
</div>
</div>
</div>
Upvotes: 0
Views: 87
Reputation: 743
You can use the class handler data-parsley-class-handler="#block-1"
<div id="block-1" class="block-1 border-left">
<div class="radio item-1"></div>
<div class="form-group" data-popover-name="popover-paragraph-template">
<div class="form-group" data-popover-name="popover-field-template">
<div id="componentHider">
<input type="email" data-parsley-class-handler="#block-1" data-parsley-email="" id="email" name="email" class="form-control parsley-error" placeholder="Nieuw e-mailadres" data-parsley-id="3622">
<ul class="parsley-errors-list filled" id="parsley-id-3622"></ul>
</div>
</div>
</div>
Don't forget to add a selector. in this example I used id="block-1"
Upvotes: 0