Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript JQuery variable to CSS?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #148714

    I just started an HTML ‘sandbox’ at http://jsfiddle.net/Jtanm/ and I have some problems with it…

    I converted the CSS which was entered into a textarea element into a variable and tried to use the .css() jQuery function but it does not work unlike the .html() function.

    Please help me out.

    #148804
    TheDoc
    Member

    The css() function styles a particular element that you’ve selected. It all depends on how you want the styles to work.

    If you want users to be able to put in any styles like:

    .test {
        background: blue;
    }
    

    Then you’ll need to do something like this:

    $("#sb").append('<style>'+sourceC+'</style>');
    
    #148868

    Thank you very much for your help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.