title: jeasyui - how to replace text with image
body: <h1>Is there a way in jeasyui to replace text with image? I need to replace words &quot;Yes&quot; and &quot;No&quot; with images in all results under th Status. Here's what I have:</h1>
  <pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.6.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;http://www.jeasyui.com/easyui/jquery.easyui.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;http://www.jeasyui.com/easyui/datagrid-detailview.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
  $(function(){
      $('#dg').datagrid({
          view: detailview,
          detailFormatter:function(index,row){
              return '&lt;div class=&quot;ddv&quot;&gt;&lt;/div&gt;';
          },
          onExpandRow: function(index,row){
              var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
              ddv.panel({
                  border:false,
                  cache:false,
                  href:'show_form_RO.php?ID='+row.ID,
                  onLoad:function(){
                      $('#dg').datagrid('fixDetailRowHeight',index);
                  }
              });
              $('#dg').datagrid('fixDetailRowHeight',index);
          },
          rowStyler:function(index,row){
              if (row.Status=='No'){
                  return 'background-color:pink;color:blue;font-weight:bold;';
              }
          }
      });
  });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;table id=&quot;dg&quot; style=&quot;width: 1100px; height: 550px&quot; url=&quot;get_records.php&quot; toolbar=&quot;#toolbar&quot;
          pagination=&quot;true&quot; fitcolumns=&quot;true&quot; singleselect=&quot;true&quot;&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th field=&quot;Checkedby&quot; width=&quot;50&quot; sortable=&quot;true&quot;&gt;
                      Checked By
                  &lt;/th&gt;
                  &lt;th field=&quot;Status&quot; width=&quot;50&quot; sortable=&quot;true&quot;&gt;
                      Successful?
                  &lt;/th&gt;
                  &lt;th field=&quot;Date&quot; width=&quot;50&quot; sortable=&quot;true&quot;&gt;
                      Date
                  &lt;/th&gt;
                  &lt;th field=&quot;Notes&quot; width=&quot;50&quot;&gt;
                      Explain if backup failed
                  &lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
      &lt;/table&gt;
  </code></pre>
  <p>I tried to add this script to the head but it didn't work:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      $(&quot;#dg:contains('1')&quot;).html(function (_, html) {
       return html.replace(/\b1\b/,&quot;&lt;img src='images/ok.png' /&gt;&quot;);
  });
      $(&quot;#dg:contains('-1')&quot;).html(function (_, html) {
       return html.replace(/-1/,&quot;&lt;img src='images/fail.gif' /&gt;&quot;)
  });
  &lt;/script&gt;
  </code></pre>
  <p>Thank you for any help.</p>