我想知道如何点击它后我可以显示不同的按钮。例如:
<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“what”和按钮2隐藏select id =“whatever”并显示“whatever2”和按钮3相同的东西。谢谢!
答案 0 :(得分:1)
$('input[type="button"]').click(function() {
$(this).hide().siblings('input:eq(0)').fadeIn();
})
请检查:fiddle
答案 1 :(得分:0)
$("#buttonId").click(function(){
$("#selectId").show();
})
答案 2 :(得分:0)
button1的
$( "#button1" ).click(function() {
$( "#whatever" ).show();
});
BUTTON2
$( "#button2" ).click(function() {
$( "#whatever" ).hide();$( "#whatever2" ).show();
});
等等
答案 3 :(得分:-1)
<input type="button" value="Submit" onclick="document.getElementById('whatever').style.display = 'block';" id="button1">
通过jQuery
$('#yourbuttonId').click(function()
$('#whatever').show();
});