File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ function saveParticipantsAndStartSimulation() {
159159 masterContainers . forEach ( ( masterContainer , index ) => {
160160 let nameInput = masterContainer . querySelector ( ".master-name" ) ;
161161 console . log ( masterContainer . innerHTML ) ; // Log the contents of the master container
162+ // Updated to find the servant dropdown inside the servant-selection div
162163 let servantDropdown = masterContainer . querySelector ( ".servant-selection .servant-select" ) ;
163164 let pictureEl = masterContainer . querySelector ( ".master-img" ) ;
164165
@@ -174,8 +175,9 @@ function saveParticipantsAndStartSimulation() {
174175
175176 if ( selectedOption ) {
176177 servantId = selectedOption . value || "Unknown" ;
177- servantName = selectedOption . dataset . name || selectedOption . textContent || "Unknown" ;
178- }
178+ servantName = selectedOption . dataset && selectedOption . dataset . name
179+ ? selectedOption . dataset . name
180+ : selectedOption . textContent || "Unknown" ;
179181
180182 console . log ( `Selected Servant (from option): id=${ servantId } , name=${ servantName } ` ) ;
181183 } else {
@@ -204,6 +206,7 @@ function saveParticipantsAndStartSimulation() {
204206}
205207
206208
209+
207210//code to attach the above function to the button:
208211document . addEventListener ( "DOMContentLoaded" , function ( ) {
209212 const startButton = document . getElementById ( "simulation" ) ;
You can’t perform that action at this time.
0 commit comments