JSFiddle - React, Tailwind, and code Playground
by mrcl
HTML
<div class="qwrap">
<ul class="head odd i0">
<li class="dimension odd"> </li>
<li class="odd itemhead i1"><label class="noclick" title="Zeiteinheit">Zeiteinheit</label></li>
<li class="even itemhead i2"><label class="noclick"></label></li>
</ul>
<ul class="body odd i0 firstItem ">
<li class="dimension odd i0"><label class="noclick" title="Konzerte in kleinerem Rahmen, zum Beispiel in Bars oder Clubs, besuchen">Konzerte in kleinerem Rahmen, zum Beispiel in Bars oder Clubs, besuchen </label></li>
<li class="d1 item odd i1"><label for="v_43x1" title="Konzerte in kleinerem Rahmen, zum Beispiel in Bars oder Clubs, besuchen, Zeiteinheit"><span class="category">Zeiteinheit </span><select name="v_43" id="v_43x1"><option class="odd i1" data-textid="1" value="1">Pro Woche </option><option class="even i2" data-textid="1" value="2">Pro Monat </option><option class="odd i3" data-textid="1" value="3">Pro Jahr </option><option class="even i4" data-textid="1" value="4">nie </option></select></label></li>
<li class="d2 item even i2"><label for="v_44x2" title="Konzerte in kleinerem Rahmen, zum Beispiel in Bars oder Clubs, besuchen"><span class="category"> </span><input min="0" max="20" type="text" name="v_44" id="v_44x2"><!-- <select name="v_44" id="v_44x2"><option class="odd i1" data-textid="1" value="1"> </option><option class="even i2" data-textid="1" value="2"> </option><option class="odd i3" data-textid="1" value="3"> </option><option class="even i4" data-textid="1" value="4"> </option><option class="odd i5" data-textid="1" value="5"> </option></select> --></label></li>
</ul>
<ul class="body even i1 ">
<li class="dimension odd i0"><label class="noclick" title="Tanzen oder in Discotheken, Clubs gehen">Tanzen oder in Discotheken, Clubs gehen </label></li>
<li class="d3 item odd i1"><label for="v_29x1" title="Tanzen oder in Discotheken, Clubs gehen, Zeiteinheit"><span...
CSS
body,li { font-family:sans-serif; font-size:10pt;}
li { display:inline; }
ul {margin:0;padding:0;}
input { width:60px!important; }
li.dimension {display:inline-block;width:400px;}
JavaScript
$("select").change(function() {
var conf={
"nie":{min:0,max:0,disable:true,fill:0},
"Pro Woche":{min:1,max:20,disable:false},
"Pro Monat":{min:1,max:30,disable:false},
"Pro Jahr":{min:1,max:90,disable:false}
};
var seloption=$(this).find("option:selected").text().trim();
var inp=$(this).closest("ul.body").find("input");
inp.css("background-color","beige");
inp.attr("min",conf[seloption]["min"]);
inp.attr("max",conf[seloption]["max"]);
if (typeof conf[seloption].fill != "undefined") {
inp.val(conf[seloption].fill);
} else { inp.val(""); }
if (conf[seloption].disable == true) {
inp.attr("disabled",true);
} else { inp.attr("disabled",false); }
}).change();
$("input").change(function() {
var t=$(this),val=parseInt(t.val()),min=t.attr("min"),max=t.attr("max");
if (val > max) { t.val(""); return true; }
if (val < min) { t.val(""); return true; }
if (isNaN(val)) { t.val(""); return true; }
});