Black border on IE7 buttons on textarea/input focus

我们两清 提交于 2019-11-30 15:38:30

I blogged about this issue here: http://markmintoff.com/2012/01/remove-internet-explorer-black-border-around-button/

Essentially you can use the following style to remove the offending border simply and effectively.

    input[type=submit],
    input[type=reset],
    input[type=button]
    {
        filter:chroma(color=#000000);
        color:#010101;
    }
mdellanoce

IE is highlighting the form's "default" button, the button that will be triggered if you press the enter key inside one of the form inputs. To disable the highlighting, you have a couple options:

  1. Make the save button type="button" instead of type="submit", and handle the form submission by handling the button's click event in javascript. This was the answer to this related question (although ASP.NET is handling the javascript part behind the scenes).
  2. Add a second type="submit" button as the first input in the form, then hide it with CSS. Note that display:none; will not cut it, you need to hide it by positioning it off screen with something like: position: absolute; top: 0; left: -9999px;. This was the answer to this related question.

jquery: $('input[type="submit"]').focus().blur();

javascript:

document.getElementById('save').focus();
document.getElementById('save').blur();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!