How to replace a style attribute?

How to replace a style attribute?

Assume the web page contains the following code

  1. <div style="height: 80px; padding:10px 0;">
    ....
    </div>


Now I want to replace the 80px value by a 50px value.


How can I achieve this for a) the first occurency and b) for all occurencies?

The following does not work:


  1. $("div[style='height: 80px;'").css("height","50px");