How to remove all input outline?


Tags: javascript,jquery,html,css,html5

Problem :

I want to remove all form inputs outline. Is it possible to remove input outline using jQuery?

I only know how to use CSS like:

input, select, textarea, form {
    outline: none;
}


Solution :

You could do something like this:

// once the page loads
window.onload = function() {
  // set the style for all these elements to outline: none;
  $("input, select, textarea, form").css("outline", "none");
};

So once the page loads, all elements' outlines will be set to none. However, I would suggest using CSS unless there is a specific reason why you want to use jQuery.

And for later appended elements (such as elements that appear after the page loads), you can add this code after the above code:

// once an element appears
$("input, select, textarea, form").ready(function() {
  // set the style for all these elements to outline: none;
  $("input, select, textarea, form").css("outline", "none");
});

    CSS Howto..

    .show() not working on page load

    How to make LESS combine CSS rules with a comma

    Showing only one row of items with css independently of users resolution?

    Show Feed in two columns in HTML

    How to make form line up?

    How * tag can be used in CSS?

    How to align HTML elements from bottom to top?

    How to change the way a copy-paste text behaves?

    How to resize all div images to a particular size?

    How to divide a menu horizontaly between buttons , using CSS?

    R markdown: how to change style with internal css?

    How do I customize the rdoc Darkfish stylesheet?

    How to make page layout responsive for every successive little change in window size?

    css: How to add blank space under a sprint element

    how to make this gradient vertical

    How to apply an active state to a CSS sprite?

    CKEditor — How can I add document-specific CSS styles

    how to inherit classes in css

    How to automatically choose which css to use depending on the URL/website and/or server I'm on?

    CSS How to attach input box to bottom of divider window

    How can I center vertically a div in bootstrap?

    How does positioning work in HTML/CSS?

    css: how to position a X sign at the top right corner of the img element

    How to Center an image on top of another image using CSS?

    How do I do the css for this?

    how to draw a shape by using canvas or css? [closed]

    How to stack two UL classes directly on top of one another in the middle of the page

    how to move fixed slider to top when scrolling using CSS only

    How to replicate this css media jquery using javascript to support IE

    CSS: How to fake a :hover state?