你好,我想禁用按钮时,选择选项是一个特定的属性。禁用选项选择按钮
我的代码是这样的:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
\t $("company").on('change',function(){
\t if($(this).find(':value').text()=="Dove Sei?")
\t $("#buttonSurvey").attr('disabled',true)
\t else
\t \t $("#buttonSurvey").attr('disabled',false)
\t });
</script>
<select class="selectpicker" data-live-search="true" id="company" data-size="5" title="Dove Sei?" data-width="100%">
<option data-tokens="Dove sei?" value="Dove Sei?" id="Dove Sei?" selected>Dove sei?</option>
<option data-tokens="another" id="another" value="another" data-picture="another.png">another</option>
<option data-tokens="another" id="another" value="another" data-picture="another.png">another</option>
<option data-tokens="another" id="another" value="another" data-picture="another.png">another</option>
</select>
<ul class="list-group" style="text-align: center;">
<li class="list-group-item" style="border-style: none;"><h4>Servizio</h4>
<div class="btn-group">
\t <button id="buttonSurvey" type="submit" class="btn btn-default" data-toggle="modal" data-target="#voteReg" name="survey1" value="green" onclick="getVote(this.value)" style="border: none;"><img src="Q1.png}" class="Vote"></button>
\t <button id="buttonSurvey" type="submit" class="btn btn-default" data-toggle="modal" data-target="#voteReg" name="survey1" value="green" onclick="getVote(this.value)" style="border: none;"><img src="Q2.png}" class="Vote"></button>
</div></li>
如果选项值为鸠SEI?我想禁用按钮。我可以试试这个代码,但不要运行。
你能帮我吗?
如果我想禁用所有的按钮? –