Skip to content

Instantly share code, notes, and snippets.

@nicco88
Last active January 4, 2017 02:50
Show Gist options
  • Select an option

  • Save nicco88/8ef89f5a1a5ac73de01a057b542b239a to your computer and use it in GitHub Desktop.

Select an option

Save nicco88/8ef89f5a1a5ac73de01a057b542b239a to your computer and use it in GitHub Desktop.
toggle menu
var payTab = {
onlineMethod: document.getElementById("online-method"),
offlineMethod: document.getElementById("offline-method"),
onlineOption: document.getElementsByClassName("online-option"),
offlineOption: document.getElementsByClassName("offline-option"),
onlineBtn: document.getElementById("online-radio-btn").getElementsByTagName("ins")[0],
toggleOnlineOption: function() {
// toggle online options
for (var i = 0; i < this.onlineOption.length; i++) {
if (this.onlineOption[i].style.display === "") {
this.onlineOption[i].style.display = "none";
} else {
this.onlineOption[i].style.display = "";
}
}
// close offline options
for (var i = 0; i < this.offlineOption.length; i++) {
this.offlineOption[i].style.display = "none";
}
},
toggleOfflineOption: function() {
//toggle offline options
for (var i = 0; i < this.offlineOption.length; i++) {
if (this.offlineOption[i].style.display === "") {
this.offlineOption[i].style.display = "none";
} else {
this.offlineOption[i].style.display = "";
}
}
// close online options
for (var i = 0; i < this.onlineOption.length; i++) {
this.onlineOption[i].style.display = "none";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment