0

How to get all css property and its value from an element ?

I am trying to make a plugin for live editing css of an element. If an element have already any style then get it and append value to input fields so that I can edit already set styles.

I dont have the property name, so how to run a loop and and get all css property and its value. and then put it an array.

my dummy code

function get_css(elem){
    var newObj = {};    
    elem.each(function(){
        var css = this.css('?');
        newObj[parts[property]] = parts[value];
    });
    return newObj;           
}

Here is the fiddle http://jsfiddle.net/howtoplease/4Nv2C/

6

1 Answer 1

0

maybe you could put properties in object

myObj : {

color: 'black'; }

and then maybe you can go over with for in loop and take value or properties and then push into an array

for(var property in myObj){

console.log(property);

}
Sign up to request clarification or add additional context in comments.

1 Comment

my problem is that I dont have property name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.