How to parse the default css property to inline style attribute
At the moment I have a page where users can create divs and drag/drop them into another div
I have a save button that gets the html of holder.
The divs in holder have some styling from a CSS file and inline styling:
style="left:10px; right:10px; background-color:#000000;" added by jQuery.
What I want is to combine the styling from my CSS file with the inline styling so I am able to use
$('#holder').html(); and have all styles.
Question: How can I parse the CSS styling into the
So after the info an example of what I have: http://jsfiddle.net/Ub9ZD/
As you can see im missing the width, height and position style.
== EDIT ==
After looking at given link I'm still stuggling with this.
I still can't combine the inline style and CSS style from file.
That's not as easy as it sounds, not by a long shot. If you want to look at an object's CSS properties, you can use the
.css() function jQuery provides. Essentially, you'd retrieve each of the element's styles via the
.css() function and reapply them to the element with the
htmlELement.style method. Then, theoretically,
.html() would give you a list of all the CSS styles on that element.
Are you sure that's what you need, or can you just use
.css() the way it's intended?