Dan Atkinson schrieb:
> Hey all!
> 
> I'm sorry if this has been discussed before (I did a search without any
> results on the subject), but does jQuery have the ability to change the
> font-weight with the css method (or a font-weight method)?
> 
> I had a look in the API documentation and VisualjQuery, but neither show
> anything for it.
> 
> For instance, for something like this:
> $("p").css({ color: "black", font-weight: "normal" });
> or
> $("p").css({ color: "red", font-weight: "bolder" });
> 
> Here you can see the first is normal text, while the other is red and
> bold(er) for a warning.
> 
> Anyhow, just wondering if font-weight was inside jQuery at all?
> 
> Cheers,
> 
> Dan


Dan, your code should actually work as is. Nonetheless I recommend to 
separate behavior and presentation and would instead add a class (avoid 
presentational naming!) to the element:

$("p").addClass('warning');

.warning {
     color: red;
     font-weight: bolder;
}

That way you have also much more control for print and other style 
sheets as if you would use the style attribute...


-- Klaus


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to