html - 移動(dòng)端radio無(wú)法選中
問(wèn)題描述
<label for='flag1'><input type='radio' name='flag' value='1' /><i class='fa fa-circle-o'></i> <img src='http://www.aoyou183.cn/wenda/flag1.png' /></label><label for='flag2'><input type='radio' name='flag' value='2' /><i class='fa fa-circle-o'></i> <img src='http://www.aoyou183.cn/wenda/flag2.png' /></label><label for='flag3'><input type='radio' name='flag' value='3' /><i class='fa fa-circle-o'></i> <img src='http://www.aoyou183.cn/wenda/flag3.png' /></label>
點(diǎn)第三個(gè)的時(shí)候第一個(gè)會(huì)選中,非要精確點(diǎn)input那個(gè)點(diǎn)才能選擇,遇到過(guò)兩次了,就是不知道什么原因造成的
問(wèn)題解答
回答1:label標(biāo)簽不是這樣用的,他的開(kāi)始跟閉合標(biāo)簽之間不能加其他標(biāo)簽。否則他的for屬性不起作用的。<label for='a'></label><input type....... />這樣就可以他會(huì)自己去找id為a的標(biāo)簽
回答2:lable失效,/lable位置不對(duì)吧放在input前面試試
回答3:我發(fā)現(xiàn)是mui的js影響到的,具體是怎么影響的還不清楚,因?yàn)槲野秧?yè)面的mui.js去掉了就正常了,加上就出現(xiàn)異常
找到問(wèn)題所在了,我在mui.js v2.8.0 第920行左右找到以下代碼
var handle = function(event, target) { if (target.tagName === ’LABEL’) {if (target.parentNode) {//問(wèn)題就出在這一行target = target.parentNode.querySelector(’input’);} } if (target && (target.type === ’radio’ || target.type === ’checkbox’)) {if (!target.disabled) { //disabledreturn target;} } return false;};
可以在引入mui之前加上以下代碼解決
<script>window.FastClick = true;</script>
相關(guān)文章:
1. php - mysql 模糊搜索問(wèn)題2. php如何獲取訪問(wèn)者路由器的mac地址3. javascript - js setTimeout在雙重for循環(huán)中如何使用?4. php - 微信開(kāi)發(fā)驗(yàn)證服務(wù)器有效性5. javascript - 在 vue里面用import引入js文件,結(jié)果為undefined6. 小程序怎么加外鏈,語(yǔ)句怎么寫(xiě)!求救新手,開(kāi)文檔沒(méi)發(fā)現(xiàn)7. html - 爬蟲(chóng)時(shí)出現(xiàn)“DNS lookup failed”,打開(kāi)網(wǎng)頁(yè)卻沒(méi)問(wèn)題,這是什么情況?8. 求救一下,用新版的phpstudy,數(shù)據(jù)庫(kù)過(guò)段時(shí)間會(huì)消失是什么情況?9. python沒(méi)入門(mén),請(qǐng)教一個(gè)問(wèn)題10. javascript - 我的站點(diǎn)貌似被別人克隆了, google 搜索特定文章,除了域名不一樣,其他的都一樣,如何解決?
