Replace CSS Properties

Replace CSS properties under a selected class

by Mahbub Alam

HTML

<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<div class="test">
  <span style="position:fixed;">a</span>
  <span style="position: fixed;">b</span>
  <span class="myclass">c</span>
</div>

CSS

.myclass {
  position: fixed;
}

JavaScript

$('.test *').filter(function() {
  var boolValue = $(this).css("position") === 'fixed';
  if (boolValue) {
    $(this).css("position", "relative");
  }
});