Assign a CSS generated image to cells in a table depending on the value of the cell

只谈情不闲聊 提交于 2019-12-24 04:33:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!