0
我有以下代碼,我想製作一個地址列表。 當我點擊「kies klant」時,我想列出姓名,地址和電話號碼。就像我有1,2,3。當我比選擇它時,它必須出現在三個選擇字段中。 我只是無法弄清楚如何?用Jquery隱藏選擇表格
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(window).load(function(){
$('.btnChoice').on('click', function(){
$('#divChoices').show()
thefield = $(this).prev()
$('.btnselect').on('click', function(){
theselected = $(this).prev()
thefield.val(theselected.val())
$('#divChoices').hide()
})
})
$('#divChoices').css({
'border':'2px solid red',
'position':'fixed',
'top':'100',
'left':'200',
'display':'none'
})
});
</script>
</head>
<body>
<div class="divform">
<input type="text" id="sku1" name="sku1">
<input type="text" id="sku2" name="sku2">
<input type="text" id="sku3" name="sku3">
<button id="choice1" class="btnChoice">Kies klant</button>
</div>
<div id="divChoices">
Kies hier uw klant:
<br>
<input type="text" name="ch1" id="ch1" value="1" >
<input type="text" id="ch2" name="ch2" value="2">
<input type="text" id="ch3" name="ch3" value="3">
<button id="btnsel2" class="btnselect">Select</button>
</div>
</body>
</html>
作品完美,感謝 – user2924759
請記住這是正確的答案,如果你認爲它幫助你:) – krishgopinath