![scale image][1]
[1]: http://i.stack.imgur.com/rUjSU.png
<script>
$(document).ready(function() {
$('#gettext').bind('input',function(){
$('.deadline1 > li').css('background-color','transparent');
var valuesX = $('#gettext').val();
$('#ap_feet').val(valuesX);
$('.deadline1 li').each(function(){
var strip = $(this).attr('data');
if(strip == valuesX)
{
for(var i=4; i<=strip; i++)
{
$('#neck_'+i).css('background-color','red');
$('div[id^="'+i+'."]').filter(function(){return this.id.match(/\d+$/)}).css('background-color','red');
console.log(i);
}
}
});
});
});
</script>
<ul class="deadline1">
<li id="neck_7" data="7"><span class="feet_num">7 feet</span> ____</li>
<li id="neck_6.11" data="6.11">.</li>
<li id="neck_6.10" data="6.10">.</li>
<li id="neck_6.9" data="6.9">.</li>
<li id="neck_6.8" data="6.8">.</li>
<li id="neck_6.7" data="6.7">.</li>
<li id="neck_6.6" data="6.6">__</li>
<li id="neck_6.5" data="6.5">.</li>
<li id="neck_6.4" data="6.4">.</li>
<li id="neck_6.3" data="6.3">.</li>
<li id="neck_6.2" data="6.2">.</li>
<li id="neck_6.1" data="6.1">.</li>
<li id="neck_6" data="6"><span class="feet_num">6 feet</span> ____</li>
<li id="neck_5.11" data="5.11">.</li>
<li id="neck_5.10" data="5.10">.</li>
<li id="neck_5.8" data="5.9">.</li>
<li id="neck_5.8" data="5.8">.</li>
<li id="neck_5.7" data="5.7">.</li>
<li id="neck_5.6" data="5.6">__</li>
<li id="neck_5.5" data="5.5">.</li>
<li id="neck_5.4" data="5.4">.</li>
<li id="neck_5.3" data="5.3">.</li>
<li id="neck_5.2" data="5.2">.</li>
<li id="neck_5.1" data="5.1">.</li>
<li id="neck_5" data="5"><span class="feet_num">5 feet</span>____</li>
<li id="neck_4.11" data="4.11">.</li>
<li id="neck_4.10" data="4.10">.</li>
<li id="neck_4.9" data="4.9">.</li>
<li id="neck_4.8" data="4.8">.</li>
<li id="neck_4.7" data="4.7">.</li>
<li id="neck_4.6" data="4.6">__</li>
<li id="neck_4.5" data="4.5">.</li>
<li id="neck_4.4" data="4.4">.</li>
<li id="neck_4.3" data="4.3">.</li>
<li id="neck_4.2" data="4.2">.</li>
<li id="neck_4.1" data="4.1">.</li>
<li id="neck_4" data="4"><span class="feet_num">4 feet</span> ____</li>
</ul>
“这是我的规模,我从文本字段的给定值中选择 li 元素,通过该值,我需要从当前代码更改 lis 的背景,它只更改那些 id 为单一的 lis 的值,我的意思是没有 id 。 ex(4.1 ...)等我想将这些值循环到“..