Answers.Body: <p>Please see the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference?desktop=true" rel="nofollow">Civi JavaScript reference</a> , specially this:</p>
  
  <pre><code>CRM.$(function($) {
  
  // Your code here
  
   });
  </code></pre>
  
  <blockquote>
    <p>Remember that CRM.$ is our alias of jQuery. So the first line is shorthand notation for CRM.$('document').ready(function($) {
    The function receives jQuery as it's param, so now we have access to jQuery as the familiar $ for use in our code.</p>
  </blockquote>
  
  <p>Also make sure you are targeting the right template:  <a href="https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Contact/Page/View/RelationshipSelector.tpl" rel="nofollow">CRM/Contact/Page/View/RelationshipSelector.tpl</a></p>
  
  <p>A different approach would be to create a custom template as explained <a href="http://wiki.civicrm.org/confluence/plugins/servlet/mobile#content/view/86213551" rel="nofollow">here</a> and disable the actions links based on $context</p>
  
  <p><strong>Update</strong>: according to dataTable API, you could do this:</p>
  
  <pre><code>CRM.$(function($) {
      var table = $('table.crm-contact-relationship-selector-current').DataTable();
      var column = table.column('.crm-contact-relationship-links');
      column.visible( false );
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-09T23:41:58.787Z
Answers.LastActivityDate: 2015-09-10T09:19:29.140Z
Answers.LastEditDate: 2015-09-10T09:19:29.140Z
Answers.UserDisplayName: Andrei
Body: <p>I tried hiding the edit, delete, enable and disable links in contact relationships writing an extension in the hook _civicrm_alterContent and injecting jquery:</p>
  
  <pre><code>  $content= $content . "
      &lt;script type='text/javascript'&gt;
        CRM.$(document).ready(
          function($) {
            $( '.crm-contact-relationship-links span a:nth-child(2)' ).remove();
            $( '.crm-contact-relationship-links span:nth-child(2)' ).remove();
          }
        );
      &lt;/script&gt;
    ";
  </code></pre>
  
  <p>The data I want to hide is supplied through Ajax and apparently out of Jquery's reach because I don't see the desired effect. </p>
  
  <p>Then I tried it using the <a href="https://datatables.net/reference/api/%24%28%29" rel="nofollow">dataTable API</a>:</p>
  
  <pre><code>        &lt;script type='text/javascript'&gt;
  
        CRM.$(document).ready(
          function($) {
            var table = $('table.crm-contact-relationship-selector-current').DataTable();
            table.$( '.crm-contact-relationship-links span a:nth-child(2)' ).remove();
            table.$( '.crm-contact-relationship-links span:nth-child(2)' ).remove();
          }
        );
      &lt;/script&gt;
  </code></pre>
  
  <p>Without success!</p>
  
  <p>Any suggestion to still reach my goal? </p>
  
Tags: <ajax>
Title: How do I partially hide Ajax supplied content?
ThreadText: # How do I partially hide Ajax supplied content?
  
  (Asked by: username_0 on 2015-09-09)
  
  I tried hiding the edit, delete, enable and disable links in contact relationships writing an extension in the hook \_civicrm\_alterContent and injecting jquery:
  
  ```
    $content= $content . "
      <script type='text/javascript'>
        CRM.$(document).ready(
          function($) {
            $( '.crm-contact-relationship-links span a:nth-child(2)' ).remove();
            $( '.crm-contact-relationship-links span:nth-child(2)' ).remove();
          }
        );
      </script>
    ";
  
  ```
  
  The data I want to hide is supplied through Ajax and apparently out of Jquery's reach because I don't see the desired effect.
  
  Then I tried it using the [dataTable API](https://datatables.net/reference/api/%24%28%29):
  
  ```
          <script type='text/javascript'>
  
        CRM.$(document).ready(
          function($) {
            var table = $('table.crm-contact-relationship-selector-current').DataTable();
            table.$( '.crm-contact-relationship-links span a:nth-child(2)' ).remove();
            table.$( '.crm-contact-relationship-links span:nth-child(2)' ).remove();
          }
        );
      </script>
  
  ```
  
  Without success!
  
  Any suggestion to still reach my goal?
  
  **Tags:** ajax
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-09. Score: 2 | Accepted answer
  
  Please see the [Civi JavaScript reference](http://wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference?desktop=true) , specially this:
  
  ```
  CRM.$(function($) {
  
  // Your code here
  
   });
  
  ```
  
  > Remember that CRM.$ is our alias of jQuery. So the first line is shorthand notation for CRM.$('document').ready(function($) {
  > The function receives jQuery as it's param, so now we have access to jQuery as the familiar $ for use in our code.
  
  Also make sure you are targeting the right template: [CRM/Contact/Page/View/RelationshipSelector.tpl](https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Contact/Page/View/RelationshipSelector.tpl)
  
  A different approach would be to create a custom template as explained [here](http://wiki.civicrm.org/confluence/plugins/servlet/mobile#content/view/86213551) and disable the actions links based on $context
  
  **Update**: according to dataTable API, you could do this:
  
  ```
  CRM.$(function($) {
      var table = $('table.crm-contact-relationship-selector-current').DataTable();
      var column = table.column('.crm-contact-relationship-links');
      column.visible( false );
  });
  
  ```
  
  
  ---
  
  