Our documentation has moved!

You are currently viewing a legacy version of our help articles.
For the most up-to-date version, please use the new Chargify Help & Support Site.
Follow

Isolate JavaScript to Public Signup Pages, Receipt Pages, and Self-Service Pages

You can add the following snippets of JavaScript to isolate specific portions of your JavaScript code on the Chargify pages of your choice.

Place custom JavaScript under Settings -> Public Page Default Settings -> Custom JavaScript.

Self-Service Page Only 

if ($('#self-service-page').length === 1) {
//code here
}
 

Public Signup Page and Receipt Page Only

if ($('#self-service-page').length === 0) {
//code here
}

Receipt Page Only

if ($('#hosted-payment-history').length !== 0) {
//code here
}
 

Public Signup Page and Self-Service Page Only

if ($('#hosted-payment-history').length === 0) {
//code here
}
 

Receipt Page and Self-Service Page Only

if ($('#total').length === 0) {
//code here
}
 

Public Signup Page Only

if ($('#total').length === 1) {
//code here
}
 

 

Example

You may want to change your submit button text to say "Subscribe" on all of your public signup pages. You can use the following Javascript: 

$( '#subscription_submit' ).val('Subscribe');

However, this will update the text of the submit button on Self-Service Pages too. Therefore, you can wrap your code inside the proper snippet from above.

Change button text on public signup page only

if ($('#total').length === 1) {
  $( '#subscription_submit' ).val('Subscribe');
}

Change button text on self-service page only

if ($('#self-service-page').length === 1) {
$( '#subscription_submit' ).val('Update Info');
}

Here's an example of the location of the Public Signup Page settings within the Chargify user interface. 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk