在jquery中,show()方法不起作用是因為該方法只適用於透過jQuery方法和css中使用「display:none」隱藏的元素,不適用透過「visibility:hidden」隱藏的元素,只需利用「元素.style.visibility="visible"」使元素顯示即可。
本教學操作環境:windows10系統、jquery3.2.1版本、Dell G3電腦。
jquery中show()方法不起作用怎麼辦
#原因:show() 適用於透過jQuery 方法和CSS 中display:none 隱藏的元素(不適用於透過visibility:hidden隱藏的元素)。
visibility:hidden 方法
visibility 屬性規定元素是否可見。
即使不可見的元素也會佔據頁面上的空間。請使用 "display" 屬性來建立不佔據頁面空間的不可見元素。
說明
這個屬性指定是否顯示一個元素產生的元素方塊。這意味著元素仍佔據其本來的空間,不過可以完全不可見。值 collapse 在表中用於從表佈局中刪除列或行。
範例如下:
<div class="curr-page" style="visibility:hidden" id="currPage"></div>//visibility:hidden表示默认隐藏
var currentBtn = document.getElementById("currPage"); currentBtn.style.visibility = "visible"; //显示 var currentBtn = document.getElementById("currPage"); currentBtn.style.visibility = "hidden"; //隐藏
若是display:none元素則可以直接使用show方法
如果被選元素已被隱藏,則顯示這些元素:
語法
$(selector).show(speed,callback)
範例如下:
<div class="curr-page" style="display:none" id="currPage"></div> //display:none表示默认隐藏
$("#currPage").show();//Jquery方法 显示 $("#currPage").hide(); //Jquery方法 隐藏
影片教學推薦:jQuery影片教學
以上是jquery中show()方法不起作用怎麼辦的詳細內容。更多資訊請關注PHP中文網其他相關文章!

Include:1)AsteeplearningCurvedUetoItsVasteCosystem,2)SeochallengesWithClient-SiderEndering,3)潛在的PersperformanceissuesInsuesInlArgeApplications,4)ComplexStateStateManagementAsappsgrow和5)TheneedtokeEedtokeEedtokeEppwithitsrapideDrapidevoltolution.thereedtokeEppectortorservolution.thereedthersrapidevolution.ththesefactorsshesssheou

reactischallengingforbeginnersduetoitssteplearningcurveandparadigmshifttocoment oparchitecent.1)startwithofficialdocumentationforasolidFoundation.2)了解jsxandhowtoembedjavascriptwithinit.3)

ThecorechallengeingeneratingstableanduniquekeysfordynamiclistsinReactisensuringconsistentidentifiersacrossre-rendersforefficientDOMupdates.1)Usenaturalkeyswhenpossible,astheyarereliableifuniqueandstable.2)Generatesynthetickeysbasedonmultipleattribute

javascriptfatigueinrectismanagbaiblewithstrategiesLike just just in-timelearninganning and CuratedInformationsources.1)學習whatyouneedwhenyouneedit

tateractComponents通過theusestatehook,使用jestandReaCtTestingLibraryToSigulationsimintionsandIntractions and verifyStateChangesInTheUI.1)underthecomponentAndComponentAndComponentAndConconentAndCheckInitialState.2)模擬useruseruserusertactionslikeclicksorformsorformsormissions.3)

KeysinreactarecrucialforopTimizingPerformanceByingIneFefitedListupDates.1)useKeyStoIndentifyAndTrackListelements.2)避免使用ArrayIndicesasKeystopreventperformansissues.3)ChooSestableIdentifierslikeIdentifierSlikeItem.idtomaintainAinainCommaintOnconMaintOmentStateAteanDimpperperFermerfermperfermerformperfermerformfermerformfermerformfermerment.ChosestopReventPerformissues.3)

ReactKeySareUniqueIdentifiers usedwhenrenderingListstoimprovereConciliation效率。 1)heelPreactrackChangesInListItems,2)使用StableanDuniqueIdentifiersLikeItifiersLikeItemidSisRecumended,3)避免使用ArrayIndicesaskeyindicesaskeystopreventopReventOpReventSissUseSuseSuseWithReRefers和4)

獨特的keysarecrucialinreactforoptimizingRendering和MaintainingComponentStateTegrity.1)useanaturalAlaluniqueIdentifierFromyourDataiFabable.2)ifnonaturalalientedifierexistsistsists,generateauniqueKeyniqueKeyKeyLiquekeyperaliqeyAliqueLiqueAlighatiSaliqueLiberaryLlikikeuuId.3)deversearrayIndiceSaskeyseSecialIndiceSeasseAsialIndiceAseAsialIndiceAsiall


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3漢化版
中文版,非常好用

Dreamweaver Mac版
視覺化網頁開發工具