Thanks but what I am really trying to do is find out all the attributes that 
define  "myClass".  Below it appears you have hard-coded certain values, but I 
won't know those ahead of time and there could be different classes per 
element, each defined differently.

Thanks, - Dave

>  -------Original Message-------
>  From: Brandon Aaron <[EMAIL PROTECTED]>
>  Subject: Re: [jQuery] How to convert "class" to "style='attrs ...'"
>  Sent: Mar 15 '07 17:44
>  
>  I didn't think MySpace allowed JavaScript either?
>  
>  Here is how you could do it.
>  $(function() {
>      $('.myClass').css({ fontFamily:'verdana', fontSize:'12px' });
>  });
>  
>  --
>  Brandon Aaron
>  
>  On 3/15/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  > I'm trying to write a function to generate MySpace friendly HTML.  MySpace 
> does not accept "link" tags, so the HTML from my page that contains 
> "class='whatever'", will mean nothing on the mySpace page.
>  >
>  > My question is, given an element with a class, e.g. "<td 
> class='myClass'>Hello</td>", how would I use jQuery to rewrite that element 
> as "<td style='font-family:verdana;font-size:12px;...>Hello</td>"?  Notice I 
> have replaced the "class" attribute with a style attribute with all the 
> attributes listed out.
>  >
>  > Thanks, - Dave
>  >
>  > _______________________________________________
>  > jQuery mailing list
>  > discuss@jquery.com
>  > http://jquery.com/discuss/
>  >
>  


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

Reply via email to