Hi Daemach.
I think I understand better now what you are trying to do. I think you
are asking "I want to find out if someone has altered the default
formatting of an element, in which case I will leave it alone. If they
have not altered it, I want to then provide some styling so that its
formatting will be more suitable than the default style of the HTML
element"
If so, normally the pattern I'd use is to provide the default style up
front, then let people override from there. They/you can ensure their
formatting overrides as desired by making their declaration either occur
later, be more specific, or have the !IMPORTANT marking.
If for some reason you can't do that, you can check to see if they did
alter the format of the element. If you are expecting it to be 13px by
default, you can check:
if (ElementInQuestion.style.fontSize == "13px"){whatever}
Yes, css would say font-size and the dom property is fontSize. Go
figure.
There may be jQuery shortcuts for this but I don't know them.
---->N
> I just tested this. When defining a style using something
> like div#myDiv it doesn't actually apply a class to the
> element. Therefore I need to find the rule in the stylesheet
> or embedded styles itself :/
>
>
> On 3/16/07, rolfsf <[EMAIL PROTECTED]> wrote:
>
>
> if it's a class you're looking for, I think you can use
> something like
> if( $('#myDiv').is('.className')) {...}
>
>
>
>
> Daemach wrote:
> >
> > I'm working on something that I want a user to be
> able to override by
> > including a specific class somewhere in the CSS
> definitions. If that
> > class
> > doesn't exist I want to add a default style. This
> seems like something
> > that
> > should have come up before but search isn't coming up
> with anything. Can
> > someone point me in the right direction? Local
> styles/classes override
> > global classes right?
> >
> > IOW given the following:
> >
> > <style>
> > #myDiv {background: blue;}
> > </style>
> >
> > <div id="myDiv" style="background: red">
> >
> > The div's background would be red, correct?
> >
> > _______________________________________________
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-find-out-if-a-%3Cstyle%3E-clas
> s-exists--tf3416167.html#a9520939
> <http://www.nabble.com/How-can-I-find-out-if-a-%3Cstyle%3E-cla
> ss-exists--tf3416167.html#a9520939>
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>
>
>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/