Skip to content Skip to sidebar Skip to footer

Get CSS Generated Text Inside A With Jquery

I have a table like this:

Solution 1:

You can get it like following using window.getComputedStyle.

var text = window.getComputedStyle($('#state')[0], ':before').content
alert(text)
.state-c:before {
  content: "Confirmed";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="orders">
  <tr>
    <td>05/06/2005</td>
    <td>3216549</td>
    <td>description</td>
    <td>2.000,00</td>
    <td>100</td>
    <td>20,00</td>
    <td><div id="state" class="state-c"> </div></td>
    <td><a href="modify.php?id=222"><span class="bt-edit">EDIT</span></a></td>
  </tr>
<table>

Solution 2:

var s = '.state-c:before { content: "Confirmed";}';
var m = s.match(/"(.*?)"/);
alert(m[1]); // m[1] = quoted

just pass the css as a string and get the text inside double quotes. hope this will help you


Solution 3:

Maybe you can try .find("#state").text("my text")


Post a Comment for "Get CSS Generated Text Inside A

05/06/2005 3216549 description With Jquery"