javascript - Get the full value of a style attribute conatining invalid css -


i trying string value of style attribute in html element. problem facing if style property has invalid value property omitted result.

example:

<article id="contact" style="margin: 10px; padding: 10px; color:{color};"> </article>  var contact =  document.getelementbyid("contact"); var style = contact.getattribute("style"); console.log(style); //prints "margin: 10px; padding: 10px;" 

i want print "margin: 10px; padding: 10px; color:{color};"

https://jsfiddle.net/wybdl7xk/2/

is there anyway can whole value in internet explorer?

*chrome works pointed below

maybe use ajax request read css document. way not getting children of dom, rather text file.

 $.when($.get("document.css")).done(function(response){        console.log(response);        // response text  }): 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -