谷歌浏览器不会触发单选按钮上的模糊事件? [英] google chrome does not fire blur event on radio buttons?

查看:152
本文介绍了谷歌浏览器不会触发单选按钮上的模糊事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在这里的第一篇文章 - 大家好



我正在开发一个支持css和jquery的html表单。该表格将被'无经验的用户'使用,所以我的重点在于良好的可用性。因此,我正在向每个输入字段提供提示,并提供进一步的说明。为了显示我使用onfocus / onblur javascript事件的提示,所以只显示一次提示。当我只有输入字段 type =text,但输入字段为 type =radio我在使用谷歌浏览器遇到麻烦。



我在快速示例/\"> jsfiddle.net ,你可以看到我的意思。这里的代码与我在表单中使用的代码非常相似,因此我不打算在此处发布代码。除了谷歌浏览器之外,我所测试的每个浏览器都会弹出警报。我想知道为什么?是否有任何已知的解决方案或解决方法?

54y69 / 217 /rel =nofollow>工作示例:

  $('input')。on ({
click:function(e){
this.focus();
$('#'+ this.id +'msg')。show();
},
blur:function(e){
$('#'+ this.id +'msg')。hide();
}
});


This is my first post here - hello everybody

I am currently developing a html form with the support of css and jquery. The form will be used by 'unexperienced users' so my focus lies on good usability. Therefor I am providing a hint to every input field with further instructions. To show the hints I am using the onfocus/onblur javascript event, so only one hint at a time is shown. This worked well when I only had input fields of type="text", but with input fields of type="radio" I am experiencing troubles in google chrome.

I made a quick example on jsfiddle.net so you can see what I mean. The code there is very similar to the code I use in my form, so I didn't bother to post it here. The alert pops up in every browser I tested so far except google chrome. I wonder why? Is there any known solution or workaround to it?

解决方案

Working sample:

$('input').on({
    click: function (e) {
        this.focus();
        $('#' + this.id + 'msg').show();
    },
    blur: function (e) {
        $('#' + this.id + 'msg').hide();
    }
});

这篇关于谷歌浏览器不会触发单选按钮上的模糊事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆