在页面加载时,我想隐藏元素#buttonSaveArea
,显示元素#buttonSaveShower
。单击 后#buttonSaveShower
,它应该隐藏并且#buttonSaveArea
应该出现。
问题是,$(document).ready
被一次又一次地调用。如何绕过它?此外,当 JavaScript 被禁用时,我希望#buttonSaveArea
从一开始就可见。
$(document).ready(function(){
$("#buttonSaveArea").hide();
$("#buttonSaveShower").click(function(){
$("#buttonSaveArea").fadeIn();
$("#buttonSaveShower").hide();
});
});
<!------ The element that should show the button below ---------------->
<div class="button" id="buttonSaveShower" style="clear:both; margin-top:15px;">
<a href="" style="width:50px !important;"> edytuj </a>
</div>
<!------ Button: save ---------------->
<div class="fbCenter" id="buttonSaveArea">
<input type="submit" value="Zapisz" class="formButton"
onmouseover="this.className+=' pressed'"
onmouseout="this.className=this.className.replace(' pressed', '')"
/>
</div>