Commit c7de07a6 authored by alexpott's avatar alexpott

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
...@@ -607,7 +607,8 @@ ...@@ -607,7 +607,8 @@
$(document).on('state:required', function (e) { $(document).on('state:required', function (e) {
if (e.trigger) { if (e.trigger) {
if (e.value) { 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. // Avoids duplicate required markers on initialization.
if (!$label.hasClass('js-form-required').length) { if (!$label.hasClass('js-form-required').length) {
$label.addClass('js-form-required form-required'); $label.addClass('js-form-required form-required');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment