我目前在我的HTML中有一個div,最初是隱藏的(使用display:none
)。禁用javascript時隱藏div顯示
<div class="fulladdress">
<p>Only display the contents of this div when an element is clicked!</p>
</div>
然後我用下面的JavaScript,以便在單擊.autocompleteitem
項目時,它顯示:
$(document).ready(function() {
$(document).on('click','.autocompleteitem:not(.autocompleteitemwithcontainer)',function(){
$("div.fulladdress").show();
});
});
然而,如果禁用JavaScript,完整的地址將永遠不會顯示。我該如何解決這個問題?
您可以通過CSS屬性來隱藏/顯示內容。 – SimpleBeat
**檢查這篇文章** [鏈接爲堆棧溢出後](http://stackoverflow.com/questions/121203/how-to-detect-if-javascript-is-disabled) – santhosh
有人簡要地發佈了一個鏈接使用jQuery的'hide',我現在調整了我的代碼來代替它。使完美的感覺:) – michaelmcgurk