Skip to content
Snippets Groups Projects
Commit c7de07a6 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1239930 by irunflower, mgifford, babruix, peterpoe, ohthehugemanatee,...

Issue #1239930 by irunflower, mgifford, babruix, peterpoe, ohthehugemanatee, droplet, nod_, Cottser, frazras, xjm: states.js appends span.form-required to every label of a dependent field
parent b0f2f838
No related branches found
No related tags found
No related merge requests found
......@@ -607,7 +607,8 @@
$(document).on('state:required', function (e) {
if (e.trigger) {
if (e.value) {
var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.js-form-item, .js-form-wrapper').find('label');
var label = 'label' + (e.target.id ? '[for=' + e.target.id + ']' : '');
var $label = $(e.target).attr({'required': 'required', 'aria-required': 'aria-required'}).closest('.js-form-item, .js-form-wrapper').find(label);
// Avoids duplicate required markers on initialization.
if (!$label.hasClass('js-form-required').length) {
$label.addClass('js-form-required form-required');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment