0
當談到jQuery時,我非常喜歡noob,我試圖使用next()選擇器來選擇下一個元素,但在使其工作時遇到一些麻煩!如何使用jQuery選擇下一個div?
我想要做的是激活slideDown(),一旦用戶完成在UI滑塊上的選擇。這裏是我的代碼:
$('.slider').slider({ stop: function(event, ui) { $(this).nextAll('.secondq:first').slideDown('slow') } });
麻煩的是,這是行不通的。只有當我把'secondq'問題放入ui滑塊的父div中時,它纔會起作用。這是我的HTML:
<div class="option">
<h2 align="left">How high is your ceiling from the floor?</h2>
<input type="text" align="right" name="bonus" class="value" disabled="disabled" />
<div class="slidewrap">
<div class="sliderFt slider"></div>
</div>
</div>
<!-- End Option -->
<div class="option">
<h2 align="left">How many windows do you have?</h2>
<input type="text" align="right" name="bonus" class="value" disabled="disabled" />
<div class="slidewrap">
<div class="sliderWinDoor slider"></div>
</div>
<div class="secondq" style="display:none;">
<h2>What type of material are your windows made of?</h2>
<div class="radiocont">
<label>Wood</label>
<input type="radio" class="styled" value="wood" name="windowtype" />
</div>
<div class="radiocont">
<label>Metal</label>
<input type="radio" class="styled" value="metal" name="windowtype" />
</div>
<div class="radiocont">
<label>PVC</label>
<input type="radio" class="styled" value="pvc" name="windowtype" />
</div>
</div>
</div>