2014-01-22 25 views
-2

我正在处理窗体,需要某些选项时禁用选项特定选项。我是jquery的初学者,需要帮助。谢谢。需要一个jQuery解决方案。如何禁用某些项目时选择一个项目

这里是链接

http://thectiweb.com/booknow_new/

我需要做的是,当我们选择从表格的第一行第一个选项,我们需要从第二行禁用一些选项是什么的选项。

这是我的html。请帮我用jQuery

HTML

<form id="calx"> 

    <div class="container"> 



     <div class="span10"> 


     <div class="row-fluid service"> 
     <h3>step 1: Select Your Service*</h3> 
     <input id="proc1" type="radio" name="proc" value="100"><label for="proc1"><img src="img/simply.png" width="120"><br></label> 
     <input id="proc2" type="radio" name="proc" value="150"><label for="proc2"><img src="img/pristine.png" width="120"><br></label> 
     <input id="proc3" type="radio" name="proc" value=""><label for="proc3"><img src="img/custom.png" width="120"><br></label> 


     </div> 


     <div class=" row-fluid beds"> 
      <h3>numbers of bedrooms</h3> 
      <input id="beds1" type="radio" name="beds" value="10"><label for="beds1"><img src="img/1.png"><br><small>one bedroom apt</small></label> 
      <input id="beds2" type="radio" name="beds" value="20"><label for="beds2"><img src="img/2.png"><br><small>two bedroom apt</small></label> 
      <input id="beds3" type="radio" name="beds" value="30"><label for="beds3"><img src="img/3.png"><br><small>three bedroom house</small></label> 
      <input id="beds4" type="radio" name="beds" value="40"><label for="beds4"><img src="img/4.png"><br><small>four bedroom house</small></label> 
      <input id="beds5" type="radio" name="beds" value="50"><label for="beds5"><img src="img/5.png"><br><small>five bedroom house</small></label> 
     </div> 


       <input type="submit" value="BOOK YOUR APPOINTMENT" class="btn btn-primary btn-large bttm" /> 


     </div> 
    </div> 
</table> 
</form> 

这是我已经试过到目前为止

$(document).ready(function() { 
    $(".service").children('input').hide(); 
    $(".service").change(function() { 
     $(".beds").children('input').hide(); 
     $(".beds").children("input[value^=" + $(this).val() + "]").show() 
    }) 

}) 
+1

你应该多看一些关于jQuery的我你是一个初学者:) – Alvaro

+0

是啊..我知道。 :)你能帮助我这一个..有点这个概念会导致我学习更多的东西在Jquery ..谢谢 – uttamcafedeweb

+0

我试着以下。但我不知道我在做什么... uttamcafedeweb

回答

0

给你

$('input[name=proc]').click(function(){ 
    $('input[name=beds]').prop('disabled', false); 
    if($(this).is('#proc1')){ 
     $('#beds1, #beds3').prop('disabled', true); //Disablin beds1 and beds3 
    } else if ($(this).is('#proc2')) { 
     //disable other buttons for proc2 
    } else { 
     //disable other buttons for proc3 
    } 

}); 

希望它可以帮助

+1

谢谢人..它的工作.. – uttamcafedeweb

0

像这样的东西应该让你开始。

var checkedId = $('form input[type=radio]:checked').attr('id'); //get the id of the checked radio button in the first set 
if(checkId = 'proc1'){ 
    $('#beds1').prop('disabled', true); //disable radio button in the second set 
} 
相关问题