HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="payment-option__entry nextpay-credit-account">
<form aria-labelledby="Personal Financial Information" class="ncpfi-container mt-nextpay" novalidate="">
<h3 class="ncpfi-container__form-title">Personal Financial Information</h3>
<p class="ncpfi-container__message">Please select an answer for each of the following questions.</p>
<fieldset>
<legend class="gapi-title"> Gross Annual Personal Income<span>*</span> </legend> <img alt="Information tooltip" class="ncpfi-form-tooltip gapi" src="https://sb.monetate.net/img/1/745/5275172.png" tabindex="0" />
<div class="ncpfi-form-tooltip-message gapi mt-hide">
<p>This is your total income before taxes and deductions. For example, £0-6k captures income between £0-6,000.</p>
<img alt="Tooltip close button" class="tooltip-close-btn" src="https://sb.monetate.net/img/1/745/5275390.png" tabindex="0" /><svg class="tooltip-chevron" fill="none" height="9" viewbox="0 0 19 9" width="19" xmlns="http://www.w3.org/2000/svg">
<path d="M1.28906 9.5H0.0819557L0.935509 8.64645L7.5213 2.06066C8.49761 1.08435 10.0805 1.08435 11.0568 2.06066L17.6426 8.64645L18.4962 9.5H17.2891H1.28906Z" fill="white" stroke="#DDDDDD" stroke-linejoin="round"></path>
</svg>
</div>
<div class="gapi-form-group">
<div class="gapi-form-group__option-container">
<div class="gapi-form-group-option"><input id="option1" name="personal-income-option" required="" type="radio" value="Gross Annual Personal Income | £0-£6,000" /> <label for="option1">£0-6k</label></div>
<div class="gapi-form-group-option"><input id="option2" name="personal-income-option" type="radio" value="Gross Annual Personal Income | £6,000-£10,000" /> <label for="option2">£6-10k</label></div>
<div class="gapi-form-group-option"><input id="option3" name="personal-income-option" type="radio" value="Gross Annual Personal Income | £10,000-£20,000" /> <label for="option3">£10-20k</label></div>
</div>
<div class="gapi-form-group__option-container">
<div class="gapi-form-group-option"><input id="option4" name="personal-income-option" type="radio" value="Gross Annual Personal Income | £20,000-£30,000" /> <label for="option4">£20-30k</label></div>
<div class="gapi-form-group-option"><input id="option5" name="personal-income-option" type="radio" value="Gross Annual Personal Income | £30,000-£40,000" /> <label for="option5">£30-40k</label></div>
<div class="gapi-form-group-option"><input id="option6" name="personal-income-option" type="radio" value="Gross Annual Personal Income | £40,000+" /> <label for="option6">£40k+</label></div>
</div>
</div>
</fieldset>
<fieldset>
<legend class="gahi-title"> Gross Annual Household Income<span>*</span> </legend> <img alt="Information tooltip" class="ncpfi-form-tooltip gahi" src="https://sb.monetate.net/img/1/745/5275172.png" tabindex="0" />
<div class="ncpfi-form-tooltip-message gahi mt-hide">
<p>This should include all income available to you. For example, your own annual income plus your spouse/partner's income.</p>
<img alt="Tooltip close button" class="tooltip-close-btn" src="https://sb.monetate.net/img/1/745/5275390.png" tabindex="0" /><svg class="tooltip-chevron" fill="none" height="9" viewbox="0 0 19 9" width="19" xmlns="http://www.w3.org/2000/svg">
<path d="M1.28906 9.5H0.0819557L0.935509 8.64645L7.5213 2.06066C8.49761 1.08435 10.0805 1.08435 11.0568 2.06066L17.6426 8.64645L18.4962 9.5H17.2891H1.28906Z" fill="white" stroke="#DDDDDD" stroke-linejoin="round"></path>
</svg>
</div>
<div class="gahi-form-group">
<div class="gahi-form-group__option-container">
<div class="gahi-form-group-option"><input id="option7" name="household-income-option" required="" type="radio" value="Gross Annual Household Income | £0-£6,000" /> <label for="option7">£0-6k</label></div>
<div class="gahi-form-group-option"><input id="option8" name="household-income-option" type="radio" value="Gross Annual Household Income | £6,000-£10,000" /> <label for="option8">£6-10k</label></div>
<div class="gahi-form-group-option"><input id="option9" name="household-income-option" type="radio" value="Gross Annual Household Income | £10,000-£20,000" /> <label for="option9">£10-20k</label></div>
</div>
<div class="gahi-form-group__option-container">
<div class="gahi-form-group-option"><input id="option10" name="household-income-option" type="radio" value="Gross Annual Household Income | £20,000-£30,000" /> <label for="option10">£20-30k</label></div>
<div class="gahi-form-group-option"><input id="option11" name="household-income-option" type="radio" value="Gross Annual Household Income | £30,000-£40,000" /> <label for="option11">£30-40k</label></div>
<div class="gahi-form-group-option"><input id="option12" name="household-income-option" type="radio" value="Gross Annual Household Income | £40,000+" /> <label for="option12">£40k+</label></div>
</div>
</div>
</fieldset>
<fieldset>
<legend class="resi-title">Residential Status<span>*</span></legend>
<div class="resi-form-group">
<div class="resi-form-group__option-container">
<div class="resi-form-group-option"><input id="option13" name="residential-income-option" required="" type="radio" value="Residential Status | Homeowner (owned outright)" /> <label for="option13">Homeowner (owned outright)</label></div>
<div class="resi-form-group-option"><input id="option14" name="residential-income-option" type="radio" value="Residential Status | Homeowner (with mortgage)" /> <label for="option14">Homeowner (with mortgage)</label></div>
</div>
<div class="resi-form-group__option-container">
<div class="resi-form-group-option"><input id="option15" name="residential-income-option" type="radio" value="Residential Status | Renting" /> <label for="option15">Renting</label></div>
<div class="resi-form-group-option"><input id="option16" name="residential-income-option" type="radio" value="Residential Status | Costs covered by someone else" /> <label for="option16">Costs covered by someone else</label></div>
</div>
</div>
</fieldset>
<fieldset>
<legend class="nodep-title">Number of Dependants<span>*</span></legend> <img alt="Information tooltip" class="ncpfi-form-tooltip nodep" src="https://sb.monetate.net/img/1/745/5275172.png" tabindex="0" />
<div class="ncpfi-form-tooltip-message nodep mt-hide">
<p>This is the number of dependants (such as children or other family members) that you are financially responsible for.</p>
<img alt="Tooltip close button" class="tooltip-close-btn" src="https://sb.monetate.net/img/1/745/5275390.png" tabindex="0" /><svg class="tooltip-chevron" fill="none" height="9" viewbox="0 0 19 9" width="19" xmlns="http://www.w3.org/2000/svg">
<path d="M1.28906 9.5H0.0819557L0.935509 8.64645L7.5213 2.06066C8.49761 1.08435 10.0805 1.08435 11.0568 2.06066L17.6426 8.64645L18.4962 9.5H17.2891H1.28906Z" fill="white" stroke="#DDDDDD" stroke-linejoin="round"></path>
</svg>
</div>
<div class="nodep-form-group">
<div class="nodep-form-group__option-container">
<div class="nodep-form-group-option"><input id="option17" name="number-of-dependants-option" required="" type="radio" value="Number of Dependants | 0" /> <label for="option17">0</label></div>
<div class="nodep-form-group-option"><input id="option18" name="number-of-dependants-option" type="radio" value="Number of Dependants | 1-2" /> <label for="option18">1-2</label></div>
<div class="nodep-form-group-option"><input id="option19" name="number-of-dependants-option" type="radio" value="Number of Dependants | 3+" /> <label for="option19">3+</label></div>
</div>
</div>
</fieldset>
<div class="ncpfi-container__credit-info">
<div class="credit-eligibility_wrapper">
<div class="credit-eligibility_messagetxt">Proceed without impacting your credit score<sup>±</sup></div>
<div class="credit-eligibility_footertxt">By clicking ‘Check My Eligibility’ you are agreeing with our <a href="https://www.next.co.uk/terms" id="ncpfi-terms-link" target="_blank">Terms and Conditions</a> and <a href="https://www.next.co.uk/privacy" id="ncpfi-privacy-link" target="_blank">Privacy Policy and Cookie Policy</a></div>
</div>
</div>
<div class="ncpfi-container__submit-container"><button class="next-pay-btn btn btn-lg btn-primary" disabled="disabled" id="ncpfi-container-submit-btn" type="submit">Check My Eligibility</button>
<div class="ncpfi-container-submit-btn-disabled-shield"> </div>
<span class="btn-nx-spinner nx-spinner-light ios"> </span>
</div>
</form>
</div>
.payment-option__entry.nextpay-credit-account {
max-width: 800px;
margin: 0 auto;
}
fieldset {
border: unset;
padding: unset;
margin: unset;
}
h3,
p,
label,
div {
font-family: "Poppins", "Azo-Sans", sans-serif !important;
}
*:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
p {
font-size: 14px;
}
button[disabled] {
opacity: 0.5;
}
.ncpfi-container {
margin: 21px 16px 16px 16px;
}
.ncpfi-container__form-title {
font-size: 16px;
font-weight: 500;
line-height: 24px;
text-align: left;
text-transform: capitalize;
margin: 16px 0 0 0;
}
.ncpfi-container__message {
margin: 10px 0 17px 0;
}
.ncpfi-container__required-message {
margin: 0 0 16px 0;
}
.ncpfi-container__message,
.ncpfi-container__required-message {
font-size: 14px;
font-weight: 400;
line-height: 21px;
text-align: left;
}
.ncpfi-container fieldset legend {
font-size: 14px;
font-weight: 500;
line-height: 21px;
text-align: left;
border-bottom: unset;
margin-bottom: 10px;
}
.ncpfi-container fieldset {
margin-bottom: 7px;
position: relative;
}
.ncpfi-container__required-message,
.ncpfi-container fieldset legend span {
color: #b30a0a;
display: none;
}
.ncpfi-form-tooltip {
max-width: 16px;
position: absolute;
}
.ncpfi-form-tooltip.gapi {
top: -30px;
left: 230px;
}
.ncpfi-form-tooltip.gahi {
top: -29px;
left: 244px;
}
.ncpfi-form-tooltip.nodep {
top: -29px;
left: 180px;
}
.ncpfi-form-tooltip:hover {
cursor: pointer;
}
.ncpfi-form-tooltip-message {
background-color: #fff;
padding: 15px 35px 15px 15px;
position: absolute;
z-index: 999;
border: 1px solid #ddd;
border-radius: 16px;
max-width: 282px;
box-shadow: 0px 2px 16px -2px #1b212c1f;
}
.ncpfi-form-tooltip-message p {
margin: unset;
}
.tooltip-close-btn {
max-width: 10px;
position: absolute;
top: 5px;
right: 6px;
padding: 10px;
box-sizing: unset;
}
.tooltip-close-btn:hover {
cursor: pointer;
}
.ncpfi-form-tooltip-message.gapi {
left: 102.6px;
top: -3px;
}
.ncpfi-form-tooltip-message.gahi {
left: 117px;
top: -3px;
}
.ncpfi-form-tooltip-message.nodep {
left: 52px;
top: -3px;
}
.ncpfi-form-tooltip-message.mt-hide {
display: none;
}
.gapi .tooltip-chevron,
.gahi .tooltip-chevron,
.nodep .tooltip-chevron {
position: absolute;
top: -9px;
right: 187px;
z-index: 999;
}
.gapi-form-group,
.gahi-form-group {
display: flex;
align-items: center;
justify-content: space-evenly;
}
.gapi-form-group,
.gahi-form-group {
display: flex;
flex-direction: column;
width: 100%;
}
.gapi-form-group__option-container,
.gahi-form-group__option-container,
.resi-form-group__option-container,
.nodep-form-group__option-container {
display: flex;
width: 100%;
margin-bottom: 10px;
justify-content: space-evenly;
gap: 16px;
}
.gapi-form-group-option,
.gahi-form-group-option,
.nodep-form-group-option {
display: flex;
width: 33.333%;
}
.resi-form-group__option-container .resi-form-group-option {
display: flex;
width: 50%;
}
.ncpfi-container label {
display: flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
background-color: #fff;
color: #000;
border: 2px solid #ddd;
border-radius: 100px;
cursor: pointer;
width: 100%;
text-align: center;
/* margin-right: 15px; */
font-size: 14px;
}
.ncpfi-container .gapi-form-group-option:last-child label,
.ncpfi-container .gahi-form-group-option:last-child label,
.ncpfi-container .resi-form-group-option:last-child label,
.ncpfi-container .nodep-form-group-option:last-child label {
margin-right: unset;
}
.ncpfi-container input[type="radio"] {
position: absolute;
opacity: 0;
width: 0;
height: 0;
}
.ncpfi-container input[type="radio"]:checked + label {
background-color: #e1efef;
border: 2px solid #027a7a;
}
.ncpfi-container input[type="radio"]:focus + label {
background-color: #e1efef;
border: 2px solid #027a7a;
}
.ncpfi-container input[type="radio"]:hover + label {
border: 2px solid #027a7a;
}
.ncpfi-container input[type="radio"]:focus-visible + label {
background-color: unset;
border: 2px solid #027a7a;
}
.ncpfi-container button {
padding: 0.5rem 1rem;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
margin-top: 1rem;
}
.ncpfi-container button:focus {
outline: 2px solid #0056b3;
}
.ncpfi-container__credit-info .credit-eligibility_wrapper {
margin-top: 10px;
margin-bottom: 5px;
}
.ncpfi-container__credit-info .credit-eligibility_footertxt {
font-size: 12px;
font-weight: 400;
line-height: 18px;
text-align: left;
}
.ncpfi-container__credit-info .credit-eligibility_footertxt a {
font-weight: 600;
}
.ncpfi-container__submit-container.ncpfi-button-unlocked
#ncpfi-container-submit-btn {
font-size: 0;
}
#ncpfi-container-submit-btn[disabled] {
font-size: 14px;
}
#ncpfi-container-submit-btn[disabled]:hover {
cursor: not-allowed;
}
.ncpfi-container__submit-container {
position: relative;
}
.ncpfi-container-submit-btn-disabled-shield {
display: none;
}
#ncpfi-container-submit-btn[disabled]
+ .ncpfi-container-submit-btn-disabled-shield {
display: block;
position: absolute;
top: 0;
z-index: 999;
width: 100%;
height: 100%;
}
#ncpfi-container-submit-btn[disabled]
+ .ncpfi-container-submit-btn-disabled-shield:hover {
cursor: not-allowed;
}
.ncpfi-container__submit-container .btn-nx-spinner.nx-spinner-light.ios {
display: none;
top: 20px;
left: 50%;
margin-left: -17px;
position: absolute;
font-size: 0;
}
.ncpfi-container__submit-container.ncpfi-button-unlocked
.btn-nx-spinner.nx-spinner-light.ios {
display: inline-block;
}
#ncpfi-terms-link:hover,
#ncpfi-privacy-link:hover {
background-color: unset;
}
.btn-primary {
background-color: #007a7a !important;
background: #007a7a;
font-weight: 500 !important;
letter-spacing: 0 !important;
height: 44px !important;
border: none !important;
background-image: none !important;
-webkit-border-radius: 32px !important;
-moz-border-radius: 32px !important;
border-radius: 32px !important;
text-transform: capitalize;
font-size: 14px;
}
.next-pay-btn {
width: 100%;
}
.credit-eligibility_wrapper {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 16px;
background: #f7f7f7;
border-radius: 8px;
}
.credit-eligibility_wrapper .credit-eligibility_messagetxt {
font-size: 14px;
font-weight: 600;
line-height: 21px;
opacity: 0.87;
margin-bottom: 8px;
}
.credit-eligibility_footertxt a {
color: #000;
font-weight: 500;
}
.btn-nx-spinner.nx-spinner-light {
background-image: url("https://www.next.co.uk/Images/Mobile/ni-loading-spinner-n-white.svg");
background-size: auto;
background-position: center;
background-repeat: no-repeat;
display: none;
top: -10px;
width: 34px;
height: 34px;
}
.nx-spinner-light:after {
-moz-animation: fa-spin 1s infinite linear;
-o-animation: fa-spin 1s infinite linear;
-webkit-animation: fa-spin 1s infinite linear;
animation: fa-spin 1s infinite linear;
background-repeat: no-repeat;
display: block;
background-size: cover;
content: "";
height: 100%;
position: relative;
width: 100%;
border-radius: 100%;
border: 2px solid rgba(255, 255, 255, 0.05);
left: calc(50% - 17px);
top: calc(50% - 17px);
background-image: url("https://www.next.co.uk/Images/Mobile/ni-loading-spinner-bg.png");
}
.btn-nx-spinner.nx-spinner-light.ios:after {
border-left-color: #fff;
border-top-color: #fff;
}
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0);
-moz-transform: rotate(0);
-ms-transform: rotate(0);
-o-transform: rotate(0);
transform: rotate(0)
}
100% {
-webkit-transform: rotate(359deg);
-moz-transform: rotate(359deg);
-ms-transform: rotate(359deg);
-o-transform: rotate(359deg);
transform: rotate(359deg)
}
}
@media (max-width: 600px) {
.resi-form-group__option-container {
flex-direction: column;
margin: 0 0 12px 0;
gap: 12px;
}
.resi-form-group__option-container .resi-form-group-option {
width: 100%;
}
}
@media (max-width: 483px) {
.gapi .tooltip-chevron,
.gahi .tooltip-chevron,
.nodep .tooltip-chevron {
display: none;
}
}
@media (max-width: 400px) {
.ncpfi-container label {
font-size: 13px;
}
}
@media (max-width: 350px) {
.gapi-form-group__option-container,
.gahi-form-group__option-container {
gap: 10px;
height: 50px;
}
}
function ready(callbackFunc) {
if (document.readyState !== "loading") {
// Document is already ready, call the callback directly
callbackFunc();
} else if (document.addEventListener) {
// All modern browsers to register DOMContentLoaded
document.addEventListener("DOMContentLoaded", callbackFunc);
} else {
// Old IE browsers
document.attachEvent("onreadystatechange", function () {
if (document.readyState === "complete") {
callbackFunc();
}
});
}
}
ready(function () {
"use strict";
const accordionNextPayElem = document.querySelector(
".payment-option__entry.nextpay-credit-account"
);
const nextpayTermsLinkElem = document.querySelector(
".mt-nextpay #ncpfi-terms-link"
);
const nextpayPrivacyLinkElem = document.querySelector(
".mt-nextpay #ncpfi-privacy-link"
);
const nextpayGapiToolTipElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip.gapi"
);
const nextpayGapiToolTipMessageElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.gapi"
);
const nextpayGapiToolTipCloseBtnElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.gapi .tooltip-close-btn"
);
const nextpayGahiToolTipElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip.gahi"
);
const nextpayGahiToolTipMessageElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.gahi"
);
const nextpayGahiToolTipCloseBtnElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.gahi .tooltip-close-btn"
);
const nextpayNodepToolTipElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip.nodep"
);
const nextpayNodepToolTipMessageElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.nodep"
);
const nextpayNodepToolTipCloseBtnElem = document.querySelector(
".mt-nextpay .ncpfi-form-tooltip-message.nodep .tooltip-close-btn"
);
const ncpfiNextPaySubmitBtnContainerElem = document.querySelector(
".mt-nextpay .ncpfi-container__submit-container"
);
const ncpfiNextPaySubmitBtnElem = document.querySelector(
".mt-nextpay #ncpfi-container-submit-btn"
);
const ncpfiNextPaySubmitBtnShieldElem = document.querySelector(
".mt-nextpay .ncpfi-container-submit-btn-disabled-shield"
);
const ncpfiNextPayPersonalIncomeradioButtons = document.querySelectorAll(
'.mt-nextpay input[name="personal-income-option"]'
);
const ncpfiNextPayHouseholdIncomeradioButtons = document.querySelectorAll(
'.mt-nextpay input[name="household-income-option"]'
);
const ncpfiNextPayResidentialStatusradioButtons = document.querySelectorAll(
'.mt-nextpay input[name="residential-income-option"]'
);
const ncpfiNextPayNumberofDependantsradioButtons = document.querySelectorAll(
'.mt-nextpay input[name="number-of-dependants-option"]'
);
const nextpayPersonalIncomeRadioGroups = document.querySelectorAll(
'.mt-nextpay input[type="radio"][name="personal-income-option"]'
);
const nextpayHouseholdIncomeRadioGroups = document.querySelectorAll(
'.mt-nextpay input[type="radio"][name="household-income-option"]'
);
const nextpayResidentialStatudRadioGroups = document.querySelectorAll(
'.mt-nextpay input[type="radio"][name="residential-income-option"]'
);
const nextpayNumberofDependantsRadioGroups = document.querySelectorAll(
'.mt-nextpay input[type="radio"][name="number-of-dependants-option"]'
);
let ncpfiNextPayPersonalIncomeSelected = false;
let ncpfiNextPayHouseholdIncomeSelected = false;
let ncpfiNextPayResidentialStatusSelected = false;
let ncpfiNextPayNumberofDependantsSelected = false;
let ncpfiNextPayPersonalIncomeValue = "";
let ncpfiNextPayHouseholdIncomeValue = "";
let ncpfiNextPayResidentialIncomeValue = "";
let ncpfiNextPayNumberOfDependantsValue = "";
// CHECKS IF NEXTPAY ACCORDION EXISTS
if (accordionNextPayElem) {
// GA - ACCORDION - OPEN/CLOSE
/*
accordionNextPayElem.addEventListener("click", (e) => {
if (e.currentTarget.classList[2] === "collapsed") {
// FIRE GA
} else {
// FIRE GA
});
*/
// GA - ACCORDION - TERMS
nextpayTermsLinkElem.addEventListener("click", () => {
// FIRE GA
});
// GA - ACCORDION - PRIVACY
nextpayPrivacyLinkElem.addEventListener("click", () => {
// FIRE GA
});
// TOOLTIPS
// GROSS ANNUAL PERSONAL INCOME - TOOLTIP - CLICK & KEYBOARD EVENTS
nextpayGapiToolTipElem.addEventListener("click", function (e) {
nextpayGapiToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
});
nextpayGapiToolTipElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayGapiToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
}
});
nextpayGapiToolTipCloseBtnElem.addEventListener("click", function (e) {
nextpayGapiToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
});
nextpayGapiToolTipCloseBtnElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayGapiToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
}
});
// GROSS ANNUAL HOUSEHOLD INCOME - TOOLTIP - CLICK & KEYBOARD EVENTS
nextpayGahiToolTipElem.addEventListener("click", function (e) {
nextpayGahiToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
});
nextpayGahiToolTipElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayGahiToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
}
});
nextpayGahiToolTipCloseBtnElem.addEventListener("click", function (e) {
nextpayGahiToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
});
nextpayGahiToolTipCloseBtnElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayGahiToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
}
});
// NUMBER OF DEPENDANTS - TOOLTIP - CLICK & KEYBOARD EVENTS
nextpayNodepToolTipElem.addEventListener("click", function (e) {
nextpayNodepToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
});
nextpayNodepToolTipElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayNodepToolTipMessageElem.classList.toggle("mt-hide");
// FIRE GA
}
});
nextpayNodepToolTipCloseBtnElem.addEventListener("click", function (e) {
nextpayNodepToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
});
nextpayNodepToolTipCloseBtnElem.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
nextpayNodepToolTipMessageElem.classList.add("mt-hide");
// FIRE GA
}
});
// GA - SUBMIT BUTTON WHEN DISABLED
ncpfiNextPaySubmitBtnShieldElem.addEventListener("click", function (e) {
// FIRE GA
});
// SUBMIT BUTTON
const ncpfiSubmitBtnChecker = () => {
if (
ncpfiNextPayPersonalIncomeSelected &&
ncpfiNextPayHouseholdIncomeSelected &&
ncpfiNextPayResidentialStatusSelected &&
ncpfiNextPayNumberofDependantsSelected
) {
ncpfiNextPaySubmitBtnElem.removeAttribute("disabled");
} else {
// DO NOTHING
}
};
ncpfiNextPayPersonalIncomeradioButtons.forEach(function (radioButton) {
radioButton.addEventListener("change", function (e) {
ncpfiNextPayPersonalIncomeSelected = true;
ncpfiSubmitBtnChecker();
// FIRE GA
});
});
ncpfiNextPayHouseholdIncomeradioButtons.forEach(function (radioButton) {
radioButton.addEventListener("change", function (e) {
ncpfiNextPayHouseholdIncomeSelected = true;
ncpfiSubmitBtnChecker();
// FIRE GA
});
});
ncpfiNextPayResidentialStatusradioButtons.forEach(function (radioButton) {
radioButton.addEventListener("change", function (e) {
ncpfiNextPayResidentialStatusSelected = true;
ncpfiSubmitBtnChecker();
// FIRE GA
});
});
ncpfiNextPayNumberofDependantsradioButtons.forEach(function (radioButton) {
radioButton.addEventListener("change", function (e) {
ncpfiNextPayNumberofDependantsSelected = true;
ncpfiSubmitBtnChecker();
// FIRE GA
});
});
ncpfiNextPaySubmitBtnElem.addEventListener("click", function (event) {
event.preventDefault();
nextpayPersonalIncomeRadioGroups.forEach((radio) => {
if (radio.checked) {
ncpfiNextPayPersonalIncomeValue = radio.value;
}
});
nextpayHouseholdIncomeRadioGroups.forEach((radio) => {
if (radio.checked) {
ncpfiNextPayHouseholdIncomeValue = radio.value;
}
});
nextpayResidentialStatudRadioGroups.forEach((radio) => {
if (radio.checked) {
ncpfiNextPayResidentialIncomeValue = radio.value;
}
});
nextpayNumberofDependantsRadioGroups.forEach((radio) => {
if (radio.checked) {
ncpfiNextPayNumberOfDependantsValue = radio.value;
}
});
// FIRE GA
// SHOW LOADING SPINNER
ncpfiNextPaySubmitBtnContainerElem.classList.add("ncpfi-button-unlocked");
});
} else {
console.info("Monetate - Issue with targeted elements");
}
});
Also see: Tab Triggers