Body: <p>I'm trying to hide some fields on a Profile based on user input by attaching JQuery events to the form elements.</p>
  <p>So I have successfully attached a function to CRM.popup according to: <a href="https://docs.civicrm.org/dev/en/latest/framework/ajax/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/ajax/</a> using the &quot;crmPopupOpen&quot; event but this is fired before the form is rendered (so no elements to attach to).</p>
  <p>How do I know when the popup form has completed loading so I can attach listeners to elements?</p>
  <p>Any help, much appreciated!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-15T11:46:30.197Z
Comments.Text: Does Civi have an event similar to Bootstrap? ala: https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_modal_event_shown&stacked=h
Comments.UserDisplayName: Darren
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-16T09:16:19.150Z
Comments.Text: A different solution to your aim is to use https://civicrm.org/extensions/profile-conditionals
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-18T16:08:08.423Z
Comments.Text: Thanks @Aidan but it's not just conditional fields, but also hierarchical selects. So that extension would mean more customisation in PHP.
Comments.UserDisplayName: Darren
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-18T16:08:41.840Z
Comments.Text: I've also tried this pattern to attach to Profile page loads. https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildProfile/ However this attaches on load, rather than when complete so back to the same issue.
Comments.UserDisplayName: Darren
Tags: <profile><ajax><jquery>
Title: Using JQuery, how can I check when a popup has finished loading?
ThreadText: # Using JQuery, how can I check when a popup has finished loading?
  
  (Asked by: username_0 on 2023-05-12)
  
  I'm trying to hide some fields on a Profile based on user input by attaching JQuery events to the form elements.
  
  So I have successfully attached a function to CRM.popup according to: <https://docs.civicrm.org/dev/en/latest/framework/ajax/> using the "crmPopupOpen" event but this is fired before the form is rendered (so no elements to attach to).
  
  How do I know when the popup form has completed loading so I can attach listeners to elements?
  
  Any help, much appreciated!
  
  **Tags:** profile, ajax, jquery
  
  > **Comments:**
  > **username_0**: Does Civi have an event similar to Bootstrap? ala: https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_ref_js_modal_event_shown&stacked=h  
  > **username_1**: A different solution to your aim is to use https://civicrm.org/extensions/profile-conditionals  
  > **username_0**: Thanks @username_1 but it's not just conditional fields, but also hierarchical selects. So that extension would mean more customisation in PHP.  
  > **username_0**: I've also tried this pattern to attach to Profile page loads. https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildProfile/ However this attaches on load, rather than when complete so back to the same issue.  
  
  ---
  
  ## 0 answers
  
  