我的页面中有两个折叠。我在collapsOne中有Btn_First。当页面加载时,我想要collapsOne将出现并折叠两个没有。当点击Btn_First时,将出现collapsTwo。 我确实喜欢下面。一切都是正确的,我在MyFunc中获得警报。但是collapsTwo不会出现。
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data- parent="#checkout" href="#collapseOne"> First Step</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<form class="register-form">
<input class="input-block-level" type="text" placeholder=" Name " id="inputname">
<input class="input-block-level" type="text" placeholder="Lname " id="inputlname">
<button class="btn btn- medium btn-general input-block-level" data-toggle="collapse" href="#collapseOne" type="submit" id="Btn_First" ">Run </button>
</form>
</div>
</div>
</div>
/////////////////
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#checkout" href="#collapseTwo"> First Step</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<form class="register-form">
<input class="input-block-level" type="text" placeholder=" Email " id="inputEmai;">
<input class="input-block-level" type="text" placeholder="Phone " id="inputPhone">
<button class="btn btn- medium btn-general input-block-level" data-toggle="collapse" href="#collapseTwo" type="submit" id="Btn_Second" ">Run </button>
</form>
</div>
</div>
</div>
///////////////////
<script type="text/javascript">
$( document ).ready( function () {
$("#collapseTwo").remove();
$('#Btn_First).click(function () {
if ( Mytemp == mytemp){ myfunc( 2 );}
});
)};
function myfunc( flag ) {
alert('hi');
if ( flag == 2 ) {
document.getElementById('collapseTwo').style.display = "visible";
}
}
</script>
答案 0 :(得分:0)
<script type="text/javascript">
$(document).ready(function()
{
$("#collapseTwo").hide();
$("#Btn_First").click(function()
{
GoFunc(2);
});
});
function Gofunc(2)
{
document.getElementById('collapseTwo').style.display = "block";
}
</script>