问题
I have the css and html here in jsfiddle. The CSS is a bit complicated (for me).
I'm working with tables that do not have specific IDs. I get them by getting their classname.
The row in the table:
<tr class = "field_34">
<th class = "kn-label">
<span>Home</span>
</th>
<td class = "kn-value">
<span>On</span>
</td>
</tr>
I would like to assign the CSS generated image to the "On" value. Can this be done? How?
Tim 333 gave the solution. Thank you! The proof is here:
http://jsfiddle.net/VpvxR/
回答1:
I kind of got it working using jquery to replace the On with some divs for your css using the code:
cssimage = '<div class="button-wrap"> <div class="button-out">On</div> <div class="button-switch"></div> </div>'
$('span:contains("On")').html(cssimage);
See http://jsfiddle.net/VpvxR/
来源:https://stackoverflow.com/questions/24875933/assign-a-css-generated-image-to-cells-in-a-table-depending-on-the-value-of-the-c