title: How to get all dynamically set inline-style CSS in jQuery?
body: <p>I want to get all the styles which has been set dynamically (which applies as inline-styles) on an element.</p>
  
  <p>For example</p>
  
  <pre><code>&lt;span class="text" style="color: rgb(128, 128, 255); font-size: 24px;"&gt;Name&lt;/span&gt;
  </code></pre>
  
  <p>I want to get the value of style attribute in a JS variable and save it.
  I have tried using jQuery's <a href="http://api.jquery.com/attr/" rel="nofollow noreferrer">.attr</a>('style'), but it's giving <strong><em>undefined</em></strong></p>
  
  <p>Also, As suggested here <a href="https://stackoverflow.com/questions/32904820/how-to-get-inline-css-style-property-from-element#answer-32904843">How to get inline CSS style property from element</a> to use</p>
  
  <pre><code>getComputedStyle
  </code></pre>
  
  <p>but to get styles I need to mention all the styles like</p>
  
  <pre><code>var el = document.querySelector("selector")
  console.log(el.style.SomeStyle);
  </code></pre>
  
  <p>but there are various styles which a user can set dynamically.
  So, do I need to mention all the <strong>inline-styles</strong> individually or is there some better way to get that?</p>
  
  <p>Thanks in advance for any help</p>
  
  <p><strong>Update from the <a href="https://stackoverflow.com/users/1496715/void">void's</a> comment:</strong></p>
  
  <p>As described here <a href="https://stackoverflow.com/questions/754607/can-jquery-get-all-css-styles-associated-with-an-element#answer-5830517">Can jQuery get all CSS styles associated with an element?</a></p>
  
  <p><a href="https://stackoverflow.com/users/342275/marknadal">marknadal</a> had wrote a function that retrieves both inline and external styles, but I just need the inline-styles irrespective of all css classes attached</p>