Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3944406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:53:47+00:00 2026-05-20T00:53:47+00:00

I am playing around with jQuery and thought I would build a little css

  • 0

I am playing around with jQuery and thought I would build a little css generator.

Currently you can see that when you make a change it just appends the change, I would like it so it in a sense updates the css output instead of adding to it. so instead of..

textarea{
font-size: 18px;

}textarea{
color: green;

}

it would be:

textarea{
font-size: 18px;
color: green;
}

http://jsfiddle.net/MSSJQ/3/

This is what I have rocking so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:53:48+00:00Added an answer on May 20, 2026 at 12:53 am

    UPDATED

    just a proof of concept, but you can get the idea…

    • DEMO: https://so.lucafilosofi.com/jquery-css-generator-update-css-output
    $(function() {
        $('#textarea').updateStyle();
    });
    
    (function($){  
    $.fn.updateStyle = function(options) {
        var defaults = {
            controls: '#controls p a',
            codewrapper: '#code'
        };
        var options = $.extend(defaults, options);
        return this.each(function() {
            $elm = $(this);
            var element = $elm.attr('type');
            $(options.controls).click(function(e) {
                e.preventDefault();
                var control_class = $(this).attr("class");
                var property_value = $(this).text();
                var css_property = control_class + ': ' + property_value + '; ';
                var property_wrapper = '.' + control_class;
                var html = '<span class="' + control_class + '">' + css_property + '<span>';
                var $outer = $('#' + element + '-outer');
                var $inner = $('#' + element + '-inner');
                if ($outer.length) {
                    if ($outer.find(property_wrapper).length) {
                        $outer.find(property_wrapper).html(css_property);
                    } else {
                        $inner.append(html);
                    }
                } else {
                    $(options.codewrapper).append('<div id="' + element + '-outer">' + 
                      element + ' {' + '<div id="' + element + '-inner">' + html + 
                      '</div> }</div>');
                }
                $elm.attr('style', $inner.text());
            });
        });
    };
    })(jQuery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing around with EF Code First and need some help. A User can
I am currently playing around with the FileSystemWatcher class wanted to know how to
Playing around with Dapper, I'm quite pleased with the results so far - intriguing!
After playing around with URL decoding myself, I managed to come up with some
been playing around with Capistrano to get an automated deploy between my server and
I was playing around with weka when I observed a minNum field in the
I've been playing around with Couchbase Server and now just tried replicating my local
I have been playing around with GIT on my local computer. As I have
I've been playing around with the html5 canvas and don't understand how the units
I've been playing around with adding hidden iframe elements to a page, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.