well, to be clear, styles, classes and css are all different things (though
obviously related) so I might be getting confused by wording about what
you're trying to do. Not to mention, I'm a js newbie... :-)
if you have a rule (either in the head or an external stylesheet) that says
#ajaxCFCLoadingIndicator { background-color: red;}
and then you dynamically create #ajaxCFCLoadingIndicator, then it has the
style background-color: red
...unless, you've added a different background-color as an inline-style,
either when you created the div or otherwise modified it via javascript
<div id="ajaxCFCLoadingIndicator style="background-color: blue;">
the inline or dynamically modified css will always take precedence (all else
equal)
r.
Daemach wrote:
>
> Hmm - in theory this could work if the style was applied immediately. I
> guess the question is, if I'm creating this element dynamically when does
> the css style get applied so I can check it? I'm doing the following at
> the
> moment, but I plan on moving the .css definition to another line once I
> figure this out.
>
> $('<div
> id="ajaxCFCLoadingIndicator"></div>').css(css).appendTo(ind[2]).hide();
>
> 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?
>> >
>
>
>
--
View this message in context:
http://www.nabble.com/How-can-I-find-out-if-a-%3Cstyle%3E-class-exists--tf3416167.html#a9521508
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/