をクリックしますが、私は毎月のをクリックすると...これは、毎月の価格に戻って変更することはできません。 ..jqueryの使用ラジオは価格.. 毎年示すこと</p> <p>私は、ドロップダウンを変更することができます...これは私が試していたものである選択オプション
私はこの問題を解決する方法をラジオボタンが
をクリックしたときに、あまりにも選択のonchange機能を実行したいですか?$(document).ready(function() {
$(".radio-billing").change(function() {
var value = $(this).val();
$("#inputBillingcycle option").each(function() {
var optionValue = $(this).val();
if (optionValue == value) {
$(this).attr("selected", "selected");
return;
}
});
});
});
function someFunction(){
console.log("function is work!");
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label>
<input class="radio-billing" type="radio" name="billingcycle" value="monthly" />
Monthly price - xxxx
</label>
<label>
<input class="radio-billing" type="radio" name="billingcycle" value="annually" />
Annually price - xxxx
</label>
<select name="billingcycle" id="inputBillingcycle" class="form-control select-inline" onchange="someFunction();">
<option value="monthly"> Monthly price - xxxx
</option>
<option value="annually"> Annually price - xxxx
</option>
</select>
ねえ、あなたのコードは仕事ですが、どのように私はあまりにも選択のonchange機能を実行するのですか? –
が更新されました。これで変更をトリガーすることができます。 – Neil
きれいな..ありがとう! –