Answers.Body: <p>I would use calculateTotalFee() to check if total amount is > 0.</p>
  
  <pre><code>CRM_Core_Resources::singleton()-&gt;addScript("
    CRM.$(function($) {
      hideshowMainProfile();
      $('#priceset [price]').bind('change keyup click blur', hideshowMainProfile);
  
      function hideshowMainProfile() {
        if (calculateTotalFee() &gt; 0) {
          $('.crm-public-form-item.crm-group.custom_pre_profile-group').show();
        }
        else {
          $('.crm-public-form-item.crm-group.custom_pre_profile-group').hide();
        }
      }
    });
  ");
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-07T10:06:27.363Z
Answers.Text: Perfect! Thanks
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-07T10:05:04.303Z
Answers.LastActivityDate: 2020-05-07T12:29:15.680Z
Answers.LastEditDate: 2020-05-07T12:29:15.680Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I would like to hide/show my "Custom Profile Group" based on the value of "Price Set Total". I already have an extension with this Jquery, but seems to be not working. Any help would be appreciated. Thanks in advance.</p>
  
  <pre><code>  CRM_Core_Resources::singleton()-&gt;addScript("
       CRM.$(function($) {
          hideshowMainProfile();
      $('#priceset [price]').bind('keyup',hideshowMainProfile);
  
      function hideshowMainProfile() {
          let priceValue = $('#priceset [price]').val();
      if (priceValue.length &gt; 1) {
        $('.crm-public-form-item.crm-group.custom_pre_profile-group').show();
      }
      else {
        $('.crm-public-form-item.crm-group.custom_pre_profile-group').hide();
      }
    }
      });
  ");
  </code></pre>
  
Tags: <ui><jquery>
Title: How to show/hide Profile based on Price set Total on a Contribution page?
ThreadText: # How to show/hide Profile based on Price set Total on a Contribution page?
  
  (Asked by: username_0 on 2020-05-07)
  
  I would like to hide/show my "Custom Profile Group" based on the value of "Price Set Total". I already have an extension with this Jquery, but seems to be not working. Any help would be appreciated. Thanks in advance.
    CRM_Core_Resources::singleton()->addScript("
       CRM.$(function($) {
          hideshowMainProfile();
      $('#priceset [price]').bind('keyup',hideshowMainProfile);
  
      function hideshowMainProfile() {
          let priceValue = $('#priceset [price]').val();
      if (priceValue.length > 1) {
        $('.crm-public-form-item.crm-group.custom_pre_profile-group').show();
      }
      else {
        $('.crm-public-form-item.crm-group.custom_pre_profile-group').hide();
      }
    }
      });
  ");
  
  **Tags:** ui, jquery
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-07. Score: 2 | Accepted answer
  
  I would use calculateTotalFee() to check if total amount is > 0.
  CRM_Core_Resources::singleton()->addScript("
    CRM.$(function($) {
      hideshowMainProfile();
      $('#priceset [price]').bind('change keyup click blur', hideshowMainProfile);
  
      function hideshowMainProfile() {
        if (calculateTotalFee() > 0) {
          $('.crm-public-form-item.crm-group.custom_pre_profile-group').show();
        }
        else {
          $('.crm-public-form-item.crm-group.custom_pre_profile-group').hide();
        }
      }
    });
  ");
  
  > **Comments:**
  > **username_0**: Perfect! Thanks  
  
  ---
  
  