Remove image borders with JavaScript


Grosk

I have an image with a border that should not work in Chrome, Safari, IE and Opera, but not in Firefox. I'm assuming it's a browser default issue, but I'm working on removing it because it's running as an AB split test and I can't modify the basic html/css to run the test. I need to do this with javaScript/jQuery.

The border I need to remove is around the "selected" image.

Here is what I have tried:

$('.selectImg').css({
    position:'absolute',
    top:'112px',
    left:'5px',
    height:'26px',
    width:'90px',
    border: 'none',
    borderStyle:'none',
    backgroundImage: "url('http://www.annsbridalbargains.com/assets/ann/images/global/selectedOption.jpg')"
});

Here is the fiddle : http://jsfiddle.net/2rULC/8/

I need to remove it for IE, Chrome and Safari. Opera can be ignored if necessary. It looks and functions the same as in Firefox.

hash pen

I'm not sure why the border appears in Webkit browsers, but when the image has no srcattributes, it seems that the gray border appears.

I have solved this by setting the srcproperty instead of using background:

$('.selectImg').css({
    position:'absolute',
    top:'112px',
    left:'5px',
    height:'26px',
    width:'90px',
    border: 'none'
}).attr('src', 'http://www.annsbridalbargains.com/assets/ann/images/global/selectedOption.jpg');

Working demo .

Related


Remove image borders with JavaScript

Grosk I have an image with a border that should not work in Chrome, Safari, IE and Opera, but not in Firefox. I'm assuming it's a browser default issue, but I'm working on removing it because it's running as an AB split test and I can't modify the basic html/c

Remove elements attached to image borders

Mostafa 2000 I'm using OpenCV to detect pneumonia in a chest x-ray using image processing, so I need to remove the additional area of the image border to get only the lungs, can anyone help me code in python? This picture explains the picture I want after appl

Javascript HTML to pdf - remove table borders

wandering ard I'm fiddling with a way to build a shallow pdf print of a table. I have the output, but I can't seem to get past the boundaries, and even after a lot of searching and trial and error, I'm still at the starting point. Anyone know enough about pdfm

Javascript HTML to pdf - remove table borders

wandering ard I'm fiddling with a way to build a shallow pdf print of a table. I have the output, but I can't seem to get past the boundaries, and even after a lot of searching and trial and error, I'm still at the starting point. Anyone know enough about pdfm

How to add and remove borders on images in JavaScript

sue There is a problem in the onclick method, I want the border on all images to be removed but only one of them is removed when a new image is clicked The error is: Uncaught TypeError: Object is not a function on line: images(i).style.display="none"; <!DOCTYP

How to add and remove borders on images in JavaScript

sue There is a problem in the onclick method, I want the border on all images to be removed but only one of them is removed when a new image is clicked The error is: Uncaught TypeError: Object is not a function on line: images(i).style.display="none"; <!DOCTYP

How to remove image borders when exporting from Excel?

DT Here is an image of my code exporting from excel to file For Each oShape In ActiveSheet.Shapes strImageName = oShape.TopLeftCell.Row & "_" & oShape.TopLeftCell.Column If oShape.Type = msoPicture Then oShape.Select 'Picture format ini

How to remove image borders when exporting from Excel?

DT Here is an image of my code exporting from excel to file For Each oShape In ActiveSheet.Shapes strImageName = oShape.TopLeftCell.Row & "_" & oShape.TopLeftCell.Column If oShape.Type = msoPicture Then oShape.Select 'Picture format ini

How to remove image borders when exporting from Excel?

DT Here is an image of my code exporting from excel to file For Each oShape In ActiveSheet.Shapes strImageName = oShape.TopLeftCell.Row & "_" & oShape.TopLeftCell.Column If oShape.Type = msoPicture Then oShape.Select 'Picture format ini

Multiple borders with borders around the image

Ronnie I want to create multiple borders around my image with some padding as shown below. I prefer to do this with just CSS, but I don't know if this is possible. When I googled I only found similar examples using box shadows to have multiple borders around o

Multiple borders with borders around the image

Ronnie I want to create multiple borders around my image with some padding as shown below. I prefer to do this with just CSS, but I don't know if this is possible. When I googled I only found similar examples using box shadows to have multiple borders around o

Javascript canvas drawImage has bigger borders of original image

Marin Bînzari I'm doing image scaling/cropping in canvas and I'm running into a problem. If like I try to generate never fit, then: In chrome (second image) both are ok Opera generates image, but incorrectly (3rd) Firefox and IE report errors.IndexSizeError: I

Javascript canvas drawImage has bigger borders of original image

Marin Bînzari I'm doing image scaling/cropping in canvas and I'm running into a problem. If like I try to generate never fit, then: In chrome (second image) both are ok Opera generates image, but incorrectly (3rd) Firefox and IE report errors.IndexSizeError: I

remove cell borders in jtable

harsh I have my custom cell renderer and want to remove the border of the cell. what should I do? I tried setBorder but it doesn't work. Here is my renderer code: public class MyTableCellRenderer extends DefaultTableCellRenderer { private static final lon

Remove specific TD borders?

Splucena I wonder why it renders correctly with or without .containercss color: red;. What's going on behind the code? How can I get the second image without deleting it .container? .container table { border-collapse: collapse; border: solid 1px #000; } .c

How to remove borders with CSS?

username I'm trying to create a matrix effect using only HTML/CSS, and the way I found out is to apply a solid border and then erase some fragments at the top and bottom, does anyone know how to create this effect using only CSS (if this is possible)? Here's a

remove cell borders in jtable

harsh I have my custom cell renderer and want to remove the border of the cell. what should I do? I tried setBorder but it doesn't work. Here is my renderer code: public class MyTableCellRenderer extends DefaultTableCellRenderer { private static final lon

Autohotkey: remove window borders

Antonio I just want to show some text with background. Despite what I've tried, there is a lot of white space around the text. Gui, +AlwaysOnTop -Border -SysMenu -Caption Gui, Add, Text, , Some text Gui, Show, AutoSize WinSet, Style, -0xC00000, A WinSet

remove some borders

Dennis I have a widget that cannot be wrapped in another div . My question is how can I remove the border of the title/title bar but still keep it around the rest of the DIV? Example below. Just adding a border on the .body won't work because things will break

Remove table borders

Doy I want to remove the following border, but I don't know how to do it. How can I remove it using CSS? Please help me, very useful! My HTML and CSS are as follows: table { width:100%; font-size:14px; } table, th, td { border: 1px solid #00b0f0;

jqplot, remove outer borders

Srihari Gold How to remove the outer border of jqplot, see the screenshot below. I tried different options and searched, but I didn't find a solution. Here is my code, plot1 = $.jqplot(container, [data], { title: 'title', animate: true,

jqplot, remove outer borders

Sri Lanka Gold How to remove the outer border of jqplot, see the screenshot below. I tried other options and searched, but I didn't find a solution. Here is my code, plot1 = $.jqplot(container, [data], { title: 'title', animate: true, a

Remove margins/borders

4 false covers As you can see from the picture, I marked the border with an X. Basically, I've removed all margins and borders, but somehow this white border shows up during print preview, which is annoying. I can't find any other way to remove the border. Ple