<!--we'll add this div on the page, so we don't have to dynamically add elements to the dom-->
<div id="astrick" style="display: none;">*</div>
<input tupe="text" id="cardNumber" class="ccInput" />
<button type="button" id="btnToggleTap">Enable Tap</button>
<button type="button" id="btnToggleError">Toggle Error</button>
document.getElementById('btnToggleTap').onclick = toggleTAP;
document.getElementById('btnToggleError').onclick = toggleError;
var astrick = document.getElementById("astrick");
var cardNumber = document.getElementById("cardNumber");
//in the iframe's js, this will perfromed in the page_init(). basically, if class is tap, then apply classes, set attribute etc.
function toggleTAP() {
cardNumber.className = "ccTapInput";
cardNumber.setAttribute("placeholder", "CREDIT CARD NUMBER");
astrick.removeAttribute("style")
astrick.className = "astrick";
}
//in the iframe's js, this would performed in the panValidate()
function toggleError() {
if (cardNumber.className.endsWith("Error")) {
cardNumber.className = cardNumber.className.replace("Error", "");;
} else {
cardNumber.className = cardNumber.className + 'Error';
}
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.