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
  • 4 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 a little jquery animation and trying to achieve a very
I'm currently playing around with the Tablesorter jQuery plugin in one of the sites
I've been playing around with jQuery's parseJSON and simplejson and I can't seem to
I was just playing around jQuery animate() . I tried to make an infinte
I'm playing around with jQuery for the first time, making a little photo slider
I'm playing around with writing a jQuery plugin that uses an attribute to define
I am new jQuery, playing around with it. I would like text box when
I'm playing around with jquery and made a form that submits information without a
I have been testing and playing around with jquery date picker below. http://jqueryui.com/demos/datepicker/ on
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there

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.