Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery problem in IE
    primarykey
    data
    text
    <p>My simple jQuery script doesn't work in IE.</p> <p>Please help.</p> <p>the whole HTML code is here: </p> <pre><code>&lt;script type="text/javascript" src="jquery-1.4.2.min.js" &gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { var cvalue = $(".space").css("backgroundColor"); $(".space").css("color",cvalue); }); &lt;/script&gt; &lt;style&gt; table.tdata td { padding: 10px; } tr.zrow1 { background-color: #ccc } tr.zrow2 { background-color: #aaa } tr.zrow1 td, tr.zrow2 td { border-top: 1px solid white; border-left: 1px solid #ccc; } table.tdata tr.thead1 { text-align: center; } table.tdata tr.thead { background-color: #003; color: white; text-align: center; } .thrColFixHdr #header h1 { margin: 0; padding: 10px 0; } .thrColFixHdr #mainContent { margin: 0 200px; padding: 0 10px; } &lt;/style&gt; &lt;div id="areaRec"&gt; &lt;h2 style="margin-top: 0pt;"&gt;Sample text&lt;/h2&gt; &lt;p&gt;Sample text Sample text Sample text Sample text Sample text Sample text Sample text Sample text&lt;span class="space"&gt;_&lt;/span&gt;text Sample text Sample text Sample text Sample text&lt;br /&gt;text Sample text Sample text Sample text Sample text text Sample text Sample text Sample text Sample text text Sample text Sample text Sample text Sample text text Sample text Sample text Sample text Sample text text Sample text Sample text Sample text Sample text&lt;/p&gt; &lt;h3 style="margin-top: 0pt;"&gt;text Sample text Sample text &lt;/h3&gt; &lt;p&gt;Sample textSample textSample textSample textSample textSample text&lt;span class="space"&gt;_&lt;/span&gt;Sample textSample textSample textSample textSample text&lt;span class="space"&gt;_&lt;/span&gt;Sample textSample textSample text textSample textSample textSample textSample textSample textSample textSample textSample textSample textSample textSample textSample textSample textSample text.&lt;/p&gt; &lt;h3 style="margin-top: 0pt;"&gt;Sample textSample textSample textSample text&lt;/h3&gt; &lt;div class="show_job"&gt; &lt;table class="job-position" border="0" cellspacing="1" cellpadding="4"&gt; &lt;tbody&gt; &lt;tr class="zrow2"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text&lt;/td&gt; &lt;td width="457" valign="top"&gt; &lt;ul&gt; &lt;li&gt;text Sample text Sample text Sample text Sample text&lt;span class="space"&gt;_&lt;/span&gt;Sample text&lt;/li&gt; &lt;li&gt;text Sample text Sample text Sample text Sample text&lt;span class="space"&gt;_&lt;/span&gt;Sample text&lt;/li&gt; &lt;li&gt;text Sample text Sample text Sample text Sample text&lt;span class="space"&gt;_&lt;/span&gt;Sample text Sample text&lt;span class="space"&gt;_&lt;/span&gt;Sample text:&lt;/li&gt; &lt;/ul&gt; &lt;blockquote&gt;&lt;ol&gt; &lt;li&gt;Adobe Photoshop&lt;/li&gt; &lt;li&gt;Adobe InDesign&lt;/li&gt; &lt;li&gt;Adobe Illustrator&lt;/li&gt; &lt;/ol&gt;&lt;ol&gt; &lt;/ol&gt;&lt;/blockquote&gt; &lt;blockquote&gt;&lt;ol&gt; &lt;/ol&gt;&lt;/blockquote&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="zrow1"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text&lt;/td&gt; &lt;td width="457" valign="top"&gt;Sample text&lt;/td&gt; &lt;/tr&gt; &lt;tr class="zrow2"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text&lt;/td&gt; &lt;td width="457" valign="top"&gt;Sample text&lt;/td&gt; &lt;/tr&gt; &lt;tr class="zrow1"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text&lt;/td&gt; &lt;td width="457" valign="top"&gt;Sample text&lt;/td&gt; &lt;/tr&gt; &lt;tr class="zrow2"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text &lt;/td&gt; &lt;td width="457" valign="top"&gt;Sample text&lt;/td&gt; &lt;/tr&gt; &lt;tr class="zrow1"&gt; &lt;td class="title-col" width="181" valign="top"&gt;Sample text &lt;/td&gt; &lt;td width="457" valign="top"&gt;Sample text&lt;span class="space"&gt;_&lt;/span&gt;Sample textSample textSample textSample text&lt;span class="space"&gt;_&lt;/span&gt;Sample textSample textSample textSample textSample text &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <h3>I think IE doesn't understand transparent value in css, any solution?</h3> <p><i><b> Final solution:</b></i><br /></p> <pre><code>$('.space').each(function(index, value){ var cvalue = $(".space").css("backgroundColor"); if(cvalue == '' || cvalue == 'transparent'){ var pcolor = ($(this).closest('div, p, tr').css('backgroundColor')); if (pcolor == '' || pcolor == 'transparent'){ //this means the closet tag hasnt any bgcolor and it is white $(this).css('color','white'); }else { $(this).css('color',pcolor); } }else{ $(this).css('color',cvalue); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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