Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're missing a semi colon at the end of your code Add that and it should be okay - <a href="http://jsbin.com/anuric/2/" rel="nofollow">http://jsbin.com/anuric/2/</a></p> <pre><code>$(document).ready(function() { var cvalue = $(".space").css("background-color"); alert(cvalue); $(".space").css("color",cvalue); }); </code></pre> <p>update;</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { var cvalue = $(".space").css("background-color"); alert(cvalue); $(".space").css("color",cvalue); }); &lt;/script&gt; </code></pre> <p><strong>Update, with your HTML;</strong> <a href="http://jsbin.com/asigah/" rel="nofollow">http://jsbin.com/asigah/</a></p> <p><strong>Update2</strong> - Ensure you have a CSS value for .space background-color in your CSS, cvalue can't find a background-color for .space if it doesn't exist.</p> <pre><code>.space { background-color: #fff; } </code></pre> <p><strong>Update 3</strong> - If you simply want to "hide" the contents of .space and just have an empty space there then use this;</p> <pre><code>$(document).ready(function() { $('.space').replaceWith('&amp;nbsp;'); }); </code></pre> <p>Working sample here; <a href="http://jsbin.com/asigah/3" rel="nofollow">http://jsbin.com/asigah/3</a></p> <p><strong>Update 4;</strong></p> <pre><code>$(document).ready(function() { $('.space').each(function(index, value){ var cvalue = ($(this).closest('div, p, tr').css('background-color')); //alert(cvalue); $(this).css('color',cvalue); }); }); </code></pre> <p>This will find the closest element( div, p or tr) tags and set the color of <code>.space</code> to be the same as the background color of the element it finds. I think this is what you want.</p> <p>Preview here - <a href="http://jsbin.com/asigah/28" rel="nofollow">http://jsbin.com/asigah/28</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload