Skip to content

Commit 35d6c0f

Browse files
Merge pull request #475 from alleyinteractive/option-label-incr-for
Update label for attr in incrementable options
2 parents db3fcb1 + 9bd9736 commit 35d6c0f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

js/fieldmanager.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ var fm_renumber = function( $wrappers ) {
8888
$( this ).attr( 'name', new_fname );
8989
if ( $( this ).attr( 'id' ) && $( this ).attr( 'id' ).match( '-proto' ) && ! new_fname.match( 'proto' ) ) {
9090
$( this ).attr( 'id', 'fm-edit-dynamic-' + dynamic_seq );
91-
var parent = $(this).closest( '.fm-item' );
92-
if ( parent.find( '.fm-label label' ).length ) {
93-
parent.find( '.fm-label label' ).attr( 'for', 'fm-edit-dynamic-' + dynamic_seq );
91+
if ( $( this ).parent().hasClass( 'fm-option' ) ) {
92+
$( this ).parent().find( 'label' ).attr( 'for', 'fm-edit-dynamic-' + dynamic_seq );
93+
} else {
94+
var parent = $( this ).closest( '.fm-item' );
95+
if ( parent.length && parent.find( '.fm-label label' ).length ) {
96+
parent.find( '.fm-label label' ).attr( 'for', 'fm-edit-dynamic-' + dynamic_seq );
97+
}
9498
}
9599
dynamic_seq++;
96100
return; // continue;

0 commit comments

Comments
 (0)