Skip to content

Commit e5c7c1c

Browse files
Merge pull request #53 from SAP/fix-multi-input
append randNum to id for unique values
2 parents ec4bbce + a81b68c commit e5c7c1c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MultiInput/MultiInput.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ export class MultiInput extends Component {
1313

1414
// create tags to display in dropdown list
1515
createTagList = data => {
16+
const randNum = Math.floor(Math.random() * 1000000 + 1);
1617
return data && data.length > 0 ? (
1718
data.map((item, index) => (
1819
<li key={index}>
19-
<label htmlFor={index} className="fd-menu__item">
20+
<label htmlFor={index + `_${randNum}`} className="fd-menu__item">
2021
<input
2122
type="checkbox"
2223
className="fd-checkbox"
23-
id={index}
24+
id={index + `_${randNum}`}
2425
value={item}
2526
onChange={this.updateSelectedTags}
2627
checked={this.isChecked(item)}

0 commit comments

Comments
 (0)