EuroCent
Klappstuhl 2.0
Hallo liebe Gemeinde... 
Leider sitze Ich vor einem kleinen Problem
Per PHP lass Ich mir diese Liste ausgeben:
$row['id'] => Wird per Datenbank-Schnittstelle geholt, spielt aber hier erstmal keine Rolle
Per jQuery Frag Ich alle Select-Felder ab:
Das klappt auch soweit bis auf diesen Punkt:
Da bekomm Ich wenn Ich via .html(), .text() oder .val() nehme "undefined".
Geb Ich in der Console direkt: $('#selArt_1').html();
dann bekomme Ich auch einen Rückgabe-Wert: "..."
Wenn Ich es per Schleife probiere, da Ich ca. 20 Selectfelder habe, dann bekomm Ich "undefined".
Wenn Ich .html(), .text() oder .val() weglasse bekomme Ich den Objekt-Typ und er findet laut Definition "#setArt_1".
Hat hier jemand eine Idee wie Ich per Scheife, beim Selektieren eines Feldes, es in die entsprechende <span>-Box bekomme?
Vielen lieben dank

Leider sitze Ich vor einem kleinen Problem

Per PHP lass Ich mir diese Liste ausgeben:
$row['id'] => Wird per Datenbank-Schnittstelle geholt, spielt aber hier erstmal keine Rolle

PHP:
$getteam = 'LEER';
$sql = $db->__query("SELECT * FROM TABELLE WHERE getteam = '{$getteam}'");
$table = '';
$count = 0;
$checkSum = 0;
while($row = $db->__fetchArray($sql)) {
$username = $row['username'];
$username = explode(".", $username);
$uname = $username[1];
$fname = $username[0];
$comName = $uname . ", " . $fname;
/* Umlaute umwandeln */
$count+= 1;
$table .= '<tr>'."\n";
$table .= '<td>'.$comName.'</td>'."\n";
$table .= '<td>'.$row['personal'].'</td>'."\n";
$table .= '<td>'."\n";
$table .= '<select name="atyp['.$row['id'].']" id="atyp['.$row['id'].']" class="form-control" required>'."\n";
$table .= '<option value="" selected>--- Bitte wählen ---</option>'."\n";
$table .= '<option value="1">06:00 bis 14:12</option>'."\n";
$table .= '<option value="2">14:45 bis 22:57</option>'."\n";
$table .= '<option value="3">06:25 bis 14:37</option>'."\n";
$table .= '<option value="4">14:20 bis 22:32</option>'."\n";
$table .= '<option value="8">08:00 bis 16:12</option>'."\n";
$table .= '<option value="10">10:00 bis 18:12</option>'."\n";
$table .= '<option value="U">Urlaub</option>'."\n";
$table .= '<option value="FOBI">Fortbildung</option>'."\n";
$table .= '<option value="FF">Feiertagfrei</option>'."\n";
$table .= '<option value="KOA">Krank ohne Attest</option>'."\n";
$table .= '<option value="K">Krank mit Attest</option>'."\n";
$table .= '<option value="KK">Kind Krank</option>'."\n";
$table .= '<option value="AZK">Gleitzeitausgleich</option>'."\n";
$table .= '<option value="ÜAZ">Überstundenabbau</option>'."\n";
$table .= '<option value="BR">Betriebsrat</option>'."\n";
$table .= '<option value="SU">Sonderurlaub</option>'."\n";
$table .= '<option value="R">Dienstreise</option>'."\n";
$table .= '<option value="MS">Mutterschutz</option>'."\n";
$table .= '<option value="EZ">Erziehungsurlaub</option>'."\n";
$table .= '<option value="BT">Backup Trainer</option>'."\n";
$table .= '<option value="VT">Vertriebstrainer + Pate</option>'."\n";
$table .= '<option value="SA">Sonderaufgabe (z.B. UAT)</option>'."\n";
$table .= '<option value="WG">Wiedereingliederung</option>'."\n";
$table .= '<option value="BS">Berufsschule</option>'."\n";
$table .= '<option value="KUR">Kur/Reha</option>'."\n";
$table .= '<option value="UF">unbez. Urlaub/Pflegezeit</option>'."\n";
$table .= '<option value="BF">bez. Freistellung</option>'."\n";
$table .= '<option value="SF">Schichtfrei</option>'."\n";
$table .= '<option value="PRO">Projekt</option>'."\n";
$table .= '</select>'."\n";
$table .= '</td>'."\n";
$table .= '<td><span id="selArt_'.$count.'">...</span></td>'."\n";
$table .= '</tr>'."\n";
$checkSum++;
}
Per jQuery Frag Ich alle Select-Felder ab:
Code:
$('select').each(function(index) {
var selArt = $('#selArt_' + index + '');
//console.log( index + ": " + $( this ).val() );
$(this).on('change', function() {
console.log(index + ": " + $(this).val());
console.log(selArt.html());
});
});
Das klappt auch soweit bis auf diesen Punkt:
Code:
$(this).on('change', function() {
console.log(index + ": " + $(this).val());
console.log(selArt.html());
});
Da bekomm Ich wenn Ich via .html(), .text() oder .val() nehme "undefined".
Geb Ich in der Console direkt: $('#selArt_1').html();
dann bekomme Ich auch einen Rückgabe-Wert: "..."
Wenn Ich es per Schleife probiere, da Ich ca. 20 Selectfelder habe, dann bekomm Ich "undefined".
Wenn Ich .html(), .text() oder .val() weglasse bekomme Ich den Objekt-Typ und er findet laut Definition "#setArt_1".
Hat hier jemand eine Idee wie Ich per Scheife, beim Selektieren eines Feldes, es in die entsprechende <span>-Box bekomme?
Vielen lieben dank

Zuletzt bearbeitet: