T
T
TANK_IST2015-01-28 16:57:29
JavaScript
TANK_IST, 2015-01-28 16:57:29

How to check block style in firefox?

In Google Chrome, this construction works:

$('.block').css('border');  //1px solid rgb(255, 0, 0)

But it doesn't work in Firefox.
Only this works
$('.block')[0].style.border
and then only after the style is set via js
$('.informer.this').css('border', '20px solid black')


How to check block style in firefox?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vyacheslav, 2015-01-28
@hedint

Solution here
In short - shorthand css properties don't work (background, margin, border,..)
you need to request full ones, like:
$('.foo').css('border-left-color')
$('.foo' ).css('border-left-width')
$('.foo').css('border-left-style')

V
Vadim, 2015-01-28
@wanhelsing

You can also use getComputedStyle() - using this method, you can even get styles that were not set via JS (only this will take more time).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question