ユーザーが選択できる 3 つのラジオ ボタンを作成します。ユーザーがそのボタンをクリックすると、ユーザーが選択したラジオボタンの説明が表示されます。
例えば
- if user select first radio button ==> it will show the description under that
radio button
- if user select second radio button ==> it will show the description under that
radio button
- if user select third radio button ==> it will show the description under that
radio button
私のコード
<p><input type='radio' name='content_type' value='1' /> This is content A of request</p>
<p><input type='radio' name='content_type' value='2' /> This is content B of request</p>
<p><input type='radio' name='content_type' value='3' /> This is content C of request</p>
<div id='show'></div>
Javascript
$(document).ready(function(){
$('#content_type').on('change', function(){
var n = $(this).val();
switch(n)
{
case '1':
document.getElementById('#show').innerHTML="1st radio button";
break;
case '2':
document.getElementById('#show').innerHTML="2nd radio button";
break;
case '3':
document.getElementById('#show').innerHTML="3rd radio button";
break;
}
});
上記のコードは機能しませんでした。この問題を示すのを手伝ってくれる人はいますか?
少し早いですがお礼を