开发者

FadeIn the Localstorage Value

开发者 https://www.devze.com 2023-04-02 00:55 出处:网络
I have few tabs which their ID is the Item in localstorage which I\'m trying to fadeIn. Tab fadeIn with: $(\'Tab1\').show();

I have few tabs which their ID is the Item in localstorage which I'm trying to fadeIn.

Tab fadeIn with: $('Tab1').show(); Now, I've set the value of 'Tabvalue' to 'Tab1' and I tried to fade it in as follow: $("#" + $(localStorage.getItem("TabValue"))).Show(); b开发者_运维技巧ut it doesn't seem to work.

Does anyone know how can I solve this problem?


Try this:

 $("#" + localStorage.getItem("TabValue")).show();

the localStorage value doesn't need to be wrapped in $() as it's a string, gets converted to an jQuery object, and back to a (mostly useless) string. Also, Show() needs to be show().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号