-6

我想知道单击它后如何显示不同的按钮。例子:

<input type="button" value="Submit" id="button1">
    <input type="button" value="Submit" id="button2" style="display: none;">
    <input type="button" value="Submit" id="button3" style="display: none;">

<select id="whatever">
<option id="1">1</select>
<option id="2">2</select>
<option id="3">3</select>
</select>

<select id="whatever2" style="display: none;">
<option id="1">1</select>
<option id="2">2</select>
<option id="3">3</select>
</select>

我希望 button1 显示选择 ID“whatever”,按钮 2 隐藏 select id="whatever" 并显示“whatever2”和按钮 3 相同的东西。谢谢!

4

4 回答 4

1
$('input[type="button"]').click(function() {
   $(this).hide().siblings('input:eq(0)').fadeIn();
})

检查这个: 小提琴

于 2013-08-23T17:05:00.343 回答
0

按钮1

$( "#button1" ).click(function() {
  $( "#whatever" ).show();
});

按钮2

$( "#button2" ).click(function() {
  $( "#whatever" ).hide();$( "#whatever2" ).show();
});

等等

于 2013-08-23T17:02:06.103 回答
0
$("#buttonId").click(function(){
   $("#selectId").show();
})
于 2013-08-23T17:00:04.550 回答
-1
<input type="button" value="Submit" onclick="document.getElementById('whatever').style.display = 'block';" id="button1">

通过 jQuery

$('#yourbuttonId').click(function()
  $('#whatever').show();
});
于 2013-08-23T17:00:28.350 回答