Forums

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

Home Forums JavaScript Edit CSS code withing textarea form

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #251105
    oskars
    Participant

    Hey guys!

    Do you have any idea on how to create this:

    I want a textarea which contains a CSS-class like this:

    textarea name=”css-class”
    .h1 {
    font-size: 21px;
    }
    /textarea

    And beside that I want a h1-element which should get it’s styling directly from the code in the textarea… So when I change the code in the textarea, the h1-element instantly updates to the new code.

    I have done my research but I haven’t found anything useful. I hope you can help out =)

    / O

    #251106
    Paulie_D
    Member

    You’ll need to parse the content with javascript. Good luck.

    I’d be searching for a plug-in inline code editor….if I understand your requirement.

    #251110
    Beverleyh
    Participant

    If I understand correctly, you can create a basic form where you save the entered CSS to a file that just so happens to be a stylesheet referenced in the head of a web page. This should start you off http://fofwebdesign.co.uk/template/_testing/test/save-file/

    Be aware – it’s extremely basic, so you should look into building on it with password protection and cleanse the data input before saving.

    And for anything more complex – like a full-blown edit-in-place solution for more complex web pages – you should do as Paulie suggested and look into some sort of plugin.

    #251260
    Shikkediel
    Participant

    And the pope is catholic but not a spammer.

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