2017-07-30 9 views

答えて

0

チェックこの

$("[name='transfer']").click(function(){ 
 
if($(this).val()=="to"){ 
 
var div2 =$('[name="from"]').detach(); 
 
$('#xyz').append(div2); 
 
}else{ 
 
var div1 = $('[name="to"]').detach(); 
 
$('#xyz').append(div1); 
 
} 
 
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<label>Transfer to airport<input type="radio" name="transfer" value="to" checked></label> 
 
<label>Transfer from airport<input type="radio" name="transfer" value="from"></label> 
 
<div id="xyz"> 
 
<input type="text" name="to" placeholder="To airport"> 
 
<input type="text" name="from" placeholder="From airport"> 
 
</div>

関連する問題