This is most likely caused because Javascript's style member only
handles the style directly applied to the tag, but not anything
cascaded or inherited. I'm not sure how jQuery's css() relates to the
element.style, but this may be a reason why.

If you were to try to grab the style of the #byClass element using
document.getElementById('#byClass').style.border, you would get an
empty string, the same thing being returned by $('#byClass').css
('border')).

They are most likely the same.

On May 1, 1:39 pm, Panman01 <rpann...@gmail.com> wrote:
> One thing to note, I've found that this only seems to work in Opera.
>
> On May 1, 1:56 pm, Panman01 <rpann...@gmail.com> wrote:
>
> > I have not been able to figure this out. If I missed some kind of RTFM
> > or something obvious please let me know. I can take it ;) Thanks
>
> > On Apr 30, 10:22 pm, Panman01 <rpann...@gmail.com> wrote:
>
> > > I just want to note that Google Groups wrapped a couple lines of the
> > > code. The DOCTYPE and jquery script will need to be fixed if you copy
> > > the code to test it.
>
> > > On Apr 30, 10:17 pm, Panman <rpann...@gmail.com> wrote:
>
> > > > For some reason I cannot get jQuery.css('name') to return a style
> > > > property that was assigned by a class. However, it returns the
> > > > property if it was assigned by style="". Has anyone else run into this
> > > > issue? Bug? Here is my test code:
>
> > > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
> > > > TR/html4/strict.dtd">
> > > > <html><head>
> > > > <title>CSSTest</title>
> > > > <style type="text/css">
> > > > .apply-border {
> > > >       border: 1px solid blue;}
>
> > > > </style>
> > > > <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/
> > > > jquery.min.js" type="text/javascript"></script>
> > > > <script type="text/javascript">
> > > > $(document).ready(function() {
> > > >       $('#byStyle').append($('#byStyle').css('border'));
> > > >       $('#byClass').append($('#byClass').css('border'));});
>
> > > > </script>
> > > > </head><body>
> > > > <p id="byStyle" style="border: 1px solid green;">Border applied by
> > > > style = </p>
> > > > <p id="byClass" class="apply-border">Border applied by class = </p>
> > > > </body></html>

Reply via email to