下午花了我一整天去處理一個Bug,我想很多人都常用Tab標籤來區分內容吧?
今天就有了這個任務,要做一個tab來區隔幾張圖表。
恩…,CSS做起來其實不難,還可以說其實很簡單。
當完成之後試試,奇怪為什麼我點選了Tab,但是我底下的頁面卻不會連動切換??
再仔細的看過我的Code,然後還到網路上找個各種範例來參考,都其實差不多阿,到底是哪邊出問題…
1 | <input type="radio" name="labelTab" id="tab1" /> |
我真的不認為我寫的有問題,一直到我忽然有點腦衝就把label裡的for值改的跟radio id相同
1 | <input type="radio" name="labelTab" id="tab1" /> |
雨過天晴世界和平了
這件事情也讓我發覺了原來label 的for其實是很重要的,或許我對label的了解不夠深入,下次可以再試看看還有沒有東西會牽動或是被牽動到。
有點晚了 好不容易撐到寫完了…. 晚安 我要睡覺了!! zzZZZZ…..
I was spend almost all afternoon to solved a problem.
Well, we normally use input radio with label in the form control,
yeah, we can just click the button to select which we want,but…..
that is to say
so this is how I use to do..
1 | <input type="radio" name="labelTab" id="tab1" /> |
What is that strange question??
why when I click label doesn’t trigger page transition?
I was searched on the internet, but no one talking about anything about this problem..
until…
1 | <input type="radio" name="labelTab" id="tab1" /> |
oh, I just realize “label” for value will trigger input radio to selected.
By Horken horkenwong@gmail.com